Last active
August 29, 2015 13:57
-
-
Save xivSolutions/9593309 to your computer and use it in GitHub Desktop.
PG Determine if Column is Auto-Incrementing serial ID
This file contains hidden or 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
SELECT (CASE ( | |
(SELECT CASE (LENGTH(pg_get_serial_sequence('artist', 'artist_id')) > 0) WHEN true THEN 1 ELSE 0 END) + | |
(SELECT CASE (SELECT pgc.relkind FROM pg_class pgc WHERE pgc.relname = 'artist' || '_' || 'artist_id' || '_' || 'seq') WHEN 'S"' THEN 1 ELSE 0 END)) | |
WHEN 0 THEN false ELSE true END) AS IsAuto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment