Created
August 9, 2020 19:48
-
-
Save mulander/52edd6bcadae4e211cd764f4c2cd1fab to your computer and use it in GitHub Desktop.
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
# This one has a defualt for serial | |
postgres=# select relname,attname, adbin from pg_attribute, pg_class, pg_attrdef where attname = 'id' and atthasdef and pg_class.oid = attrelid and adrelid = attrelid; | |
-[ RECORD 1 ]---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
relname | test2 | |
attname | id | |
adbin | {FUNCEXPR :funcid 480 :funcresulttype 23 :funcretset false :funcvariadic false :funcformat 2 :funccollid 0 :inputcollid 0 :args ({FUNCEXPR :funcid 1574 :funcresulttype 20 :funcretset false :funcvariadic false :funcformat 0 :funccollid 0 :inputcollid 0 :args ({CONST :consttype 2205 :consttypmod -1 :constcollid 0 :constlen 4 :constbyval true :constisnull false :location -1 :constvalue 4 [ 7 96 0 0 0 0 0 0 ]}) :location -1}) :location -1} | |
# no default | |
postgres=# select relname,attname, adbin from pg_attribute, pg_class, pg_attrdef where attname = 'id' and not atthasdef and pg_class.oid = attrelid and adrelid = attrelid; | |
-[ RECORD 1 ]------------------------------------------------------------------------------------------------------------------------------------------------ | |
relname | test | |
attname | id | |
adbin | {CONST :consttype 23 :consttypmod -1 :constcollid 0 :constlen 4 :constbyval true :constisnull false :location 45 :constvalue 4 [ 1 0 0 0 0 0 0 0 ]} | |
postgres=# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment