Last active
August 29, 2015 14:03
-
-
Save ivar/1132a2cb6a9e84ad6576 to your computer and use it in GitHub Desktop.
Automated query to load table structure from Rspec and Rails does not recognize "properties_view" as a valid '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
SELECT a.attname, format_type(a.atttypid, a.atttypmod), | |
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod | |
FROM pg_attribute a LEFT JOIN pg_attrdef d | |
ON a.attrelid = d.adrelid AND a.attnum = d.adnum | |
WHERE a.attrelid = '"properties_view"'::regclass # NOTE properties_view is a view on properties table | |
AND a.attnum > 0 AND NOT a.attisdropped | |
ORDER BY a.attnum; |
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
SELECT a.attname, format_type(a.atttypid, a.atttypmod), | |
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod | |
FROM pg_attribute a LEFT JOIN pg_attrdef d | |
ON a.attrelid = d.adrelid AND a.attnum = d.adnum | |
WHERE a.attrelid = '"properties"'::regclass # NOTE properties is a normal table | |
AND a.attnum > 0 AND NOT a.attisdropped | |
ORDER BY a.attnum; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note 'properties_view' is a view that selects a subset of data from the 'properties' table