Em ter., 17 de mar. de 2026 às 17:36, Adrian Klaver <
[email protected]> escreveu:

> Why is the second case not?:
>
I don't know, but you can see that it's not only for integers

CREATE TABLE default_test (
     id integer,
     fld_1 varchar DEFAULT 'test',
     fld_2 integer DEFAULT 0,
     fld_3 date DEFAULT Current_Date,
     fld_4 timestamp DEFAULT Current_Timestamp,
     fld_5 text DEFAULT 'x',
     fld_6 boolean DEFAULT 'on',
     fld_7 int4range DEFAULT '[1,2)',
     fld_8 char DEFAULT '1'
);

SELECT
     atttypid::regtype,
     pg_get_expr(adbin, adrelid)
FROM pg_class c inner join
     pg_attribute a on c.oid = attrelid
  inner join pg_attrdef d on c.oid = d.adrelid and adnum = attnum
WHERE
     relname = 'default_test' and attnum > 0;

regards
Marcs

Reply via email to