Re: porting horde to Postgresql 12, dropped pg_attrdef

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: porting horde to Postgresql 12, dropped pg_attrdef
Date: 2019-11-15 15:16:59
Message-ID: 26370.1573831019@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> writes:
> Horde (webmail and more) is not anymore compatible with postgresql 12
> after pg_attrdef was dropped.

We didn't drop the whole catalog, just the adsrc column, which has been
deprecated for ages (because it didn't update to track, eg, column
renamings). The correct substitute for adsrc is

pg_get_expr(adbin,adrelid)

which reconstructs an up-to-date text form from the authoritative
data.

I see that the v12 release notes fail to suggest this replacement,
which seems unhelpful ... I'll go add that.

Having said that, it looks like query (1) should never have been
written like this in the first place --- trying to pull bits out
of the text representation of a default expression seems horribly
fragile. I think what it's trying to do is identify serial columns?
The right way to do that is to look for pg_depend entries that link
a serial sequence to its owning column. I don't have an example
right to hand, but I'm sure there is an instance in pg_dump, and
probably elsewhere.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-11-15 15:43:10 Re: naming triggers for execution
Previous Message PegoraroF10 2019-11-15 15:14:02 Re: naming triggers for execution