shubhi
shubhi

Reputation: 9

Defaults in sql

Can we have multiple default values according to conditions stated for each default in postresql?

Like Can we have different defaults according to a entry of a column for each insert.

Upvotes: 0

Views: 40

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246013

A column default cannot depend on other columns in the table. You probably need a BEFORE INSERT trigger.

Upvotes: 1

Related Questions