/usr/share/pgmodeler/schemas/catalog/column.sch is in pgmodeler-common 0.9.1~beta-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # Catalog queries for columns
# CAUTION: Do not modify this file unless you know what you are doing.
# Code generation can be broken if incorrect changes are made.
#NOTE: For columns and other table object is needed to pass the table name as
# well the schema name of the parent table in the both data retrieving methods (list/attribs)
%if {list} %then
[ SELECT cl.attnum AS oid, cl.attname AS name FROM pg_attribute AS cl
LEFT JOIN pg_class AS tb ON tb.oid = cl.attrelid
LEFT JOIN pg_namespace AS ns ON ns.oid = tb.relnamespace
WHERE cl.attisdropped IS FALSE AND relname=]'{table}' [ AND nspname= ] '{schema}'
[ AND attnum >= 0 ORDER BY attnum ASC ]
%else
%if {attribs} %then
[SELECT cl.attnum AS oid, cl.attname AS name, cl.attnotnull AS not_null_bool,
cl.attacl AS permission, df.adsrc AS default_value,
ds.description AS comment, tb.oid AS table, ]
#Creating an attribute to indicate if the column is inherited or not
[ CASE
WHEN cl.attinhcount > 0 THEN TRUE
ELSE FALSE
END AS inherited_bool, ]
# This subquery retrieve the schema name for the type when it is undeer public schema.
# This is necessary because pgModeler identifies user-defined types by the complete
# type signature [schema].[typename]
[(SELECT
CASE
WHEN ns.nspname='public' THEN ns.nspname || '.'
ELSE ''
END
FROM pg_namespace AS ns
LEFT JOIN pg_type AS tp ON tp.typnamespace=ns.oid
WHERE tp.oid=cl.atttypid) || format_type(atttypid,atttypmod) AS type, atttypid AS type_oid, ]
%if ({pgsql-ver} == "9.0") %then
[ NULL AS collation ]
%else
[ cl.attcollation AS collation ]
%end
[ FROM pg_attribute AS cl
LEFT JOIN pg_attrdef AS df ON df.adrelid=cl.attrelid AND df.adnum=cl.attnum
LEFT JOIN pg_description AS ds ON ds.objoid=cl.attrelid AND ds.objsubid=cl.attnum
LEFT JOIN pg_class AS tb ON tb.oid = cl.attrelid
LEFT JOIN pg_namespace AS ns ON ns.oid = tb.relnamespace
WHERE cl.attisdropped IS FALSE AND relname= ] '{table}'
[ AND nspname= ] '{schema}'
[ AND attnum >= 0 ]
%if {filter-oids} %then
[ AND cl.attnum IN (] {filter-oids} )
%end
[ ORDER BY attnum ASC ]
%end
%end
|