File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 13
13
-- and https://stackoverflow.com/questions/55300370/postgresql-serial-vs-identity
14
14
with
15
15
nsp as (
16
- select
17
- nsp .oid
16
+ select nsp .oid
18
17
from pg_catalog .pg_namespace nsp
19
18
where
20
19
nsp .nspname = :schema_name_param::text
25
24
col .attrelid ::regclass::text as table_name,
26
25
col .attname ::text as column_name,
27
26
col .attnotnull as column_not_null,
27
+ s .seqrelid ::regclass::text as sequence_name,
28
28
case col .atttypid
29
29
when ' int' ::regtype then ' serial'
30
30
when ' int8' ::regtype then ' bigserial'
31
31
when ' int2' ::regtype then ' smallserial'
32
32
end as column_type,
33
- s .seqrelid ::regclass::text as sequence_name,
34
33
pg_get_expr(ad .adbin , ad .adrelid ) as column_default_value
35
34
from
36
35
pg_catalog .pg_class t
37
36
inner join nsp on nsp .oid = t .relnamespace
38
37
inner join pg_catalog .pg_attribute col on col .attrelid = t .oid
39
38
inner join pg_catalog .pg_constraint c on c .conrelid = col .attrelid and col .attnum = any(c .conkey )
40
39
inner join pg_catalog .pg_attrdef ad on ad .adrelid = col .attrelid and ad .adnum = col .attnum
41
- inner join pg_catalog .pg_depend dep on dep .refobjid = col .attrelid AND dep .refobjsubid = col .attnum
40
+ inner join pg_catalog .pg_depend dep on dep .refobjid = col .attrelid and dep .refobjsubid = col .attnum
42
41
inner join pg_catalog .pg_sequence s on s .seqrelid = dep .objid
43
42
where
44
43
col .atttypid = any(' {int,int8,int2}' ::regtype[]) and
You can’t perform that action at this time.
0 commit comments