Is it possible to retrieve the Default Value in Pgsql? I know you can use pg_meta_data to check if there exists Default but i can't find the PHP command to retrieve the value.
Regards
Mian
Can you retrieve column Default value in Pgsql?
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
a few searches turned up this:
Code: Select all
SELECT a.attname
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relname = 'tablename'
AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
ORDER BY a.attnum;