Created
April 8, 2011 21:11
-
-
Save le0pard/910749 to your computer and use it in GitHub Desktop.
Return default value of field in table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION ret_def(text,text,text) RETURNS text AS $$ | |
SELECT | |
COLUMNS.column_default::text | |
FROM | |
information_schema.COLUMNS | |
WHERE table_name = $2 | |
AND table_schema = $1 | |
AND column_name = $3 | |
$$ LANGUAGE sql IMMUTABLE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment