PostgreSQL column default values
Hi,
I'm using PostgreSQL 15 with Delphi 11 and latest UniDAC components.
Create a table:
- CREATE TABLE sample (col_a VARCHAR DEFAULT 'A');
Then use a TUniQuery that "SELECT * FROM sample", add a TDataSource linked to the query and a grid and dbnavigator linked to the datasource. Open the query and insert a new record, the grid shows the default value "A".
But if you do:
- CREATE DOMAIN d_col_a VARCHAR DEFAULT 'A';
- CREATE TABLE sample (col_a d_col_a);
you see an empty value on the grid.
Same for sequences and generated fields:
- CREATE TABLE sample (col_a SERIAL);
You see the next value as default, but with:
- CREATE TABLE sample (col_a INTEGER GENERATED BY DEFAULT AS IDENTITY);
You see an empty value.
I'm I doing something wrong?
Because if I create a trigger for the table on the BEFORE INSERT I can see the value.
Best regards.
Sergio