Hi everyone!
Is there a way to "nicely" determine a default value of a table column? A function, which could be used, like:
SELECT default_of('my_table.my_integer_column') :: integer;
?
I scanned pg_proc table:
===================================
postgres=# select proname from pg_proc where proname like '%dflt%' or proname like '%default%';
proname
------------------------
RI_FKey_setdefault_del
RI_FKey_setdefault_upd
(2 rows)
===================================
, so I guess there is no easy way to get a column default, is there?
I need it to imitate something like (notice COALESCE(...)):
INSERT INTO my_table (column1,column2,column3) VALUES (COALESCE($1, DEFAULT), 'column2_value', 'column3_value');
Regards,
Belka