mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-07 23:07:00 +02:00
Review our Postgres catalog usage for default values.
The pg_catalog.pg_attribute column adsrc is populated only once, and then not maintained by the server. The function pg_get_expr(adbin, adrelid) is what to use and has been here since release 8.0, so that's what pgloader should be using. Fixed #1934.
This commit is contained in:
parent
26cc9ca79f
commit
8a13c02561
@ -7,8 +7,8 @@ with seqattr as
|
||||
(
|
||||
select adrelid,
|
||||
adnum,
|
||||
adsrc,
|
||||
case when adsrc ~~ 'nextval'
|
||||
pg_get_expr(d.adbin, d.adrelid) as adsrc,
|
||||
case when pg_get_expr(d.adbin, d.adrelid) ~~ 'nextval'
|
||||
then substring(pg_get_expr(d.adbin, d.adrelid)
|
||||
from '''([^'']+)'''
|
||||
)
|
||||
@ -23,7 +23,9 @@ with seqattr as
|
||||
else null
|
||||
end as typmod,
|
||||
attnotnull,
|
||||
case when atthasdef then def.adsrc end as default,
|
||||
case when atthasdef
|
||||
then pg_get_expr(def.adbin, def.adrelid)
|
||||
end as default ,
|
||||
case when s.seqname is not null then 'auto_increment' end as extra
|
||||
from pg_class c
|
||||
join pg_namespace n on n.oid = c.relnamespace
|
||||
|
Loading…
Reference in New Issue
Block a user