Bug 128111 - pg_attrdef.adrsrc doesn't exist anymore from postgresql 12
Summary: pg_attrdef.adrsrc doesn't exist anymore from postgresql 12
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.3.1.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:6.4.0 target:6.3.4
Keywords:
: 128488 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-12 21:03 UTC by danielv8888
Modified: 2019-11-07 10:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description danielv8888 2019-10-12 21:03:22 UTC
Description:
pq_driver: [PGRES_FATAL_ERROR]ERREUR:  la colonne pg_attrdef.adsrc n'existe pas
LINE 1: ....attnotnull, pg_type.typdefault, pg_type.typtype, pg_attrdef...
                                                             ^
 (caused by statement 'SELECT pg_namespace.nspname, pg_class.relname, pg_attribute.attname, pg_type.typname, pg_attribute.atttypmod, pg_attribute.attnotnull, pg_type.typdefault, pg_type.typtype, pg_attrdef.adsrc, pg_description.description, pg_type.typbasetype, pg_attribute.attnum FROM pg_class, pg_attribute LEFT JOIN pg_attrdef ON pg_attribute.attrelid = pg_attrdef.adrelid AND pg_attribute.attnum = pg_attrdef.adnum LEFT JOIN pg_description ON pg_attribute.attrelid = pg_description.objoid AND pg_attribute.attnum=pg_description.objsubid, pg_type, pg_namespace WHERE pg_attribute.attrelid = pg_class.oid AND pg_attribute.atttypid = pg_type.oid AND pg_class.relnamespace = pg_namespace.oid AND NOT pg_attribute.attisdropped AND pg_namespace.nspname LIKE 'public' AND pg_class.relname LIKE 'stat_tirage' AND pg_attribute.attname LIKE '%' ORDER BY pg_namespace.nspname, pg_class.relname, pg_attribute.attnum')

Steps to Reproduce:
1.open base with postgresql 12
2.
3.

Actual Results:
no query work with postgresql 12 only

Expected Results:
the query work with postgresql 12


Reproducible: Always


User Profile Reset: No



Additional Info:
the column pg_attrdef.adsrc don't exist
Comment 1 Julien Nabet 2019-10-12 21:31:17 UTC
Indeed, from 8.0, we can read this:
"The adsrc field is historical, and is best not used, because it does not track outside changes that might affect the representation of the default value. Reverse-compiling the adbin field (with pg_get_expr for example) is a better way to display the default value."
(see https://www.postgresql.org/docs/8.0/catalog-pg-attrdef.html)

This field disappears from 12.0 version:
See https://www.postgresql.org/docs/12/catalog-pg-attrdef.html
compared to:
https://www.postgresql.org/docs/11/catalog-pg-attrdef.html

Searching "adsrc" in Opengrok gives:
https://opengrok.libreoffice.org/search?project=core&full=adsrc&defs=&refs=&path=&hist=&type=&si=full
Comment 2 Julien Nabet 2019-10-12 22:30:58 UTC
Replacement should be "pg_get_expr(adbin, adrelid)"
but it's incompatible with Postgresql < 8.
I submitted a patch on gerrit here:
https://gerrit.libreoffice.org/#/c/80722
Comment 3 Commit Notification 2019-10-13 14:40:47 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0c46c81e04530e8f6ce4f34195d8f0443ed8bfc3

tdf#128111: "adsrc" doesn't exist from Postgresql 12

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Julien Nabet 2019-10-13 14:41:53 UTC
For 6.3 branch, patch is on gerrit review here:
https://gerrit.libreoffice.org/#/c/80736/

Thank you Daniel for the report!
Comment 5 Julien Nabet 2019-10-14 07:18:55 UTC
I wanteed to test on Windows but there's no Windows Postgresql binary.
Daniel: on which env are you?
Comment 6 danielv8888 2019-10-14 10:05:10 UTC
the server postgres is on debian 10
Comment 7 danielv8888 2019-10-14 10:23:22 UTC
I also tested LibreOffice 3.2.2 under linux (debian 10), with the same problem
in fact, a simple query doesn't work!
Comment 8 danielv8888 2019-10-14 10:30:13 UTC
yes for windows -> "https://www.enterprisedb.com/downloads/postgres-postgresql-downloads"
Comment 9 Commit Notification 2019-10-15 08:07:40 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/0872f7dc87445f81afd56b5a096d026df75d3a05

tdf#128111: "adsrc" doesn't exist from Postgresql 12

It will be available in 6.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Julien Nabet 2019-10-15 12:10:18 UTC
Thank you Daniel for the link!

Just for the record, i just installed Postgresql 12.0 and had the same error with LO 6.3.2 just when trying to open a table.
Comment 11 Julien Nabet 2019-10-15 13:29:18 UTC
With master sources updated today, I could open the database and the tables.

I just noticed that when providing password, I had this log:
warn:connectivity.postgresql:25568:26308:connectivity/source/drivers/postgresql/pq_connection.cxx:474: sdbc-postgresql: unknown argument 'Type' having value: <Any: (string) simple>

Also when creating a new file to connect to Postgresql, I have this:
warn:connectivity.postgresql:25568:26308:connectivity/source/drivers/postgresql/pq_connection.cxx:474: sdbc-postgresql: unknown argument 'BooleanComparisonMode' having value: <Any: (long) 2>
warn:connectivity.postgresql:25568:26308:connectivity/source/drivers/postgresql/pq_connection.cxx:474: sdbc-postgresql: unknown argument 'EnableOuterJoinEscape' having value: <Any: (boolean) 0>
warn:connectivity.postgresql:25568:26308:connectivity/source/drivers/postgresql/pq_connection.cxx:474: sdbc-postgresql: unknown argument 'EscapeDateTime' having value: <Any: (boolean) 0>
Comment 12 Rene Engelhard 2019-10-31 06:20:07 UTC
*** Bug 128488 has been marked as a duplicate of this bug. ***
Comment 13 danielv8888 2019-11-05 14:04:50 UTC
strange, under linux with version libreoffice 6.3.3.2 I can attack PostgreSQL 12, but not with the windows version ...
Comment 14 Julien Nabet 2019-11-06 14:01:30 UTC
(In reply to danielv8888 from comment #13)
> strange, under linux with version libreoffice 6.3.3.2 I can attack
> PostgreSQL 12, but not with the windows version ...

Could you please provide error message?
Comment 15 danielv8888 2019-11-06 20:10:05 UTC
yes, always the same errors, can not open the query in "edit" mode - "the query is based on an SQL command that cannot be analyzed". SQL:HY000 error code status:1000.
I would say the patch is in version 6.3.3.2 linux debian and not in the windows version ...
I installed the 6.4alpha version, and this version works very well for me
Comment 16 Julien Nabet 2019-11-07 09:41:27 UTC
Daniel: just re read the whole bugtracker, patch is available from next release 6.3.4.
Unless you use prerelease/daily build on Linux, are you sure it works on Linux with Postgresql 12?
Comment 17 danielv8888 2019-11-07 10:07:28 UTC
under debian linux the version i use is 6.3.3.2.0+ build ID:1:6.3.3-2
how to know the version I use (stable, unstable, testing) ?
I think I'm using testing ...
Comment 18 Julien Nabet 2019-11-07 10:31:13 UTC
(In reply to danielv8888 from comment #17)
> under debian linux the version i use is 6.3.3.2.0+ build ID:1:6.3.3-2
> how to know the version I use (stable, unstable, testing) ?
> I think I'm using testing ...

Taking a look to https://packages.debian.org/search?keywords=libreoffice
it can't be stable, only unstable or testing  (both are 6.3.3-2 for amd64)

Then you can take a look to /etc/apt/sources.lst to be sure.

So since you confirmed you use 6.3.3, you don't have yet the patch.
Are you sure you connect to Postgresql 12 from Linux? If yes, I don't understand how it can work since you don't use yet the patched version.

On the contrary, it's normal it doesn't work on Windows (if you try to connect Postgresql 12 of course).
Comment 19 Julien Nabet 2019-11-07 10:33:22 UTC
Also, on which env did you install "6.4alpha version" ? if it's on Linux, it would mean you have several LO versions in Linux. The one from Debian package 6.3.3, the one you installed manually with 6.4 alpha version.
Please check carefully LO version and Postgresql server version when you test.
Comment 20 Lionel Elie Mamane 2019-11-07 10:34:11 UTC
The Debian 6.3.3-2 package has this patch backported; see https://metadata.ftp-master.debian.org/changelogs//main/libr/libreoffice/libreoffice_6.3.3-2_changelog :

libreoffice (1:6.3.3-2) unstable; urgency=medium
  * debian/patches/Postgresql-12-no-adsrc.diff: add from
    libreoffice-6-3 branch; fix the postgresql driver with
    PostgreSQL 12 (closes: #943873)
Comment 21 Julien Nabet 2019-11-07 10:38:51 UTC
I hadn't thought about backports!
It explains now why it works with Linux and not with Windows.
Thank you Lionel!