Thread: Negative values for obj_id: SELECT statements throwing errors inquery editor

Negative values for obj_id: SELECT statements throwing errors inquery editor

From
"Holger Kopp-Musick"
Date:
Hi,

I'm using pgAdmin 4.12 in desktop mode on Win 10 1809, databases are 10.9 on CentOS 7.6. When executing any SELECT in
thequery editor, I get no data but the following error message: 
Operator does not exist: - oid

I understand that converting the negative value of attrelid causes that error (full internal statement below,
apparentlyby \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql): 

SELECT at.attname, at.attnum, ty.typname
FROM pg_attribute at LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
WHERE attrelid=-1769161114::oid AND attnum =
ANY ((SELECT con.conkey FROM pg_class rel LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid AND con.contype='p'
WHERErel.relkind IN ('r','s','t') AND rel.oid = -1769161114::oid)::oid[]) 

Strange enough, showing the first 100 rows via the menu works as expected and I couldn't reproduce that error neither
ona 9.6 database (on Windows localhost) nor with pgAdmin 4.12 running on Linux (also desktop mode); pgAdmin 4.10 and
pgAdmin3 are also working without flaws. 

Any ideas or suggestions?

Thanks in advance,
Holger




Re: Negative values for obj_id: SELECT statements throwing errors inquery editor

From
Khushboo Vashi
Date:
Hi,


On Tue, Sep 3, 2019 at 7:31 PM Holger Kopp-Musick <hkopp@gmx.de> wrote:
Hi,

I'm using pgAdmin 4.12 in desktop mode on Win 10 1809, databases are 10.9 on CentOS 7.6. When executing any SELECT in the query editor, I get no data but the following error message:
Operator does not exist: - oid

I understand that converting the negative value of attrelid causes that error (full internal statement below, apparently by \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql):

SELECT at.attname, at.attnum, ty.typname
FROM pg_attribute at LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
WHERE attrelid=-1769161114::oid AND attnum =
ANY ((SELECT con.conkey FROM pg_class rel LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid AND con.contype='p' WHERE rel.relkind IN ('r','s','t') AND rel.oid = -1769161114::oid)::oid[])

Strange enough, showing the first 100 rows via the menu works as expected and I couldn't reproduce that error neither on a 9.6 database (on Windows localhost) nor with pgAdmin 4.12 running on Linux (also desktop mode); pgAdmin 4.10 and pgAdmin 3 are also working without flaws.

Any ideas or suggestions?

Are you executing Select query with joins?
As the first 100 rows are working fine, have you tried to execute the same query (which executes accessing the first 100 rows) ?

Can you please provide the logs? To enable logging please refer, https://www.pgadmin.org/faq/#8
Also, try to provide the sample query to reproduce this issue.

Thanks,
Khushboo
 
Thanks in advance,
Holger



Re: Negative values for obj_id: SELECT statements throwing errors inquery editor

From
Khushboo Vashi
Date:
Hi,

Please try to replace the  \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql file with the attached file and do not forget to take a backup of the original file.
Restart the server and check the issue gets resolved or not.

Thanks,
Khushboo




On Tue, Sep 3, 2019 at 7:31 PM Holger Kopp-Musick <hkopp@gmx.de> wrote:
Hi,

I'm using pgAdmin 4.12 in desktop mode on Win 10 1809, databases are 10.9 on CentOS 7.6. When executing any SELECT in the query editor, I get no data but the following error message:
Operator does not exist: - oid

I understand that converting the negative value of attrelid causes that error (full internal statement below, apparently by \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql):

SELECT at.attname, at.attnum, ty.typname
FROM pg_attribute at LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
WHERE attrelid=-1769161114::oid AND attnum =
ANY ((SELECT con.conkey FROM pg_class rel LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid AND con.contype='p' WHERE rel.relkind IN ('r','s','t') AND rel.oid = -1769161114::oid)::oid[])

Strange enough, showing the first 100 rows via the menu works as expected and I couldn't reproduce that error neither on a 9.6 database (on Windows localhost) nor with pgAdmin 4.12 running on Linux (also desktop mode); pgAdmin 4.10 and pgAdmin 3 are also working without flaws.

Any ideas or suggestions?

Thanks in advance,
Holger



Attachment

Aw: Re: Negative values for obj_id: SELECT statements throwingerrors in query editor

From
"Holger Kopp-Musick"
Date:
Hi,

thank you very much for your advice, I have attached the log. As proposed I've replaced the original file and restarted
theserver, yet unfortunately I'm still unable to get any results for any simple statement (ie SELECT * FROM table). In
myunderstanding the obj_id is anyhow faulty since there are no negative values of attrelid in pg_attribute. Running the
statementprimary_keys.sql with the proper value returns the requested row (table.id). 

Thanks,
Holger

> Please try to replace the  \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql file with
theattached file and do not forget to take a backup of the original file. 
> Restart the server and check the issue gets resolved or not.

Attachment

Re: Re: Negative values for obj_id: SELECT statements throwing errorsin query editor

From
Aditya Toshniwal
Date:
Hi,

I had raised the concern on psycopg2 (https://github.com/psycopg/psycopg2/issues/661#issuecomment-527739621) and looks like it is a bug in pyscopg2.

We need wait psycopg2 now to get this fixed.

On Wed, Sep 4, 2019 at 12:50 PM Holger Kopp-Musick <hkopp@gmx.de> wrote:
Hi,

thank you very much for your advice, I have attached the log. As proposed I've replaced the original file and restarted the server, yet unfortunately I'm still unable to get any results for any simple statement (ie SELECT * FROM table). In my understanding the obj_id is anyhow faulty since there are no negative values of attrelid in pg_attribute. Running the statement primary_keys.sql with the proper value returns the requested row (table.id).

Thanks,
Holger

> Please try to replace the  \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql file with the attached file and do not forget to take a backup of the original file.
> Restart the server and check the issue gets resolved or not.


--
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"

Re: Re: Re: Negative values for obj_id: SELECT statements throwingerrors in query editor

From
Aditya Toshniwal
Date:
Hi Holger,

Could you please tell us the OS details for both Postgres and pgAdmin ?

On Wed, Sep 4, 2019 at 4:24 PM Holger Kopp-Musick <hkopp@gmx.de> wrote:
Hi,
 
thank you very much for your help, indeed it looks like a problem with signed/unsigned values. I'll stay with 4.10 meanwhile.
 
Best regards,
Holger
 
Gesendet: Mittwoch, 04. September 2019 um 12:27 Uhr
Von: "Aditya Toshniwal" <aditya.toshniwal@enterprisedb.com>
An: "Holger Kopp-Musick" <hkopp@gmx.de>
Cc: "pgadmin-support lists.postgresql.org" <pgadmin-support@lists.postgresql.org>, "Khushboo Vashi" <khushboo.vashi@enterprisedb.com>
Betreff: Re: Re: Negative values for obj_id: SELECT statements throwing errors in query editor
Hi,
 
I had raised the concern on psycopg2 (https://github.com/psycopg/psycopg2/issues/661#issuecomment-527739621) and looks like it is a bug in pyscopg2.
 
We need wait psycopg2 now to get this fixed.
 
On Wed, Sep 4, 2019 at 12:50 PM Holger Kopp-Musick <hkopp@gmx.de> wrote:
Hi,

thank you very much for your advice, I have attached the log. As proposed I've replaced the original file and restarted the server, yet unfortunately I'm still unable to get any results for any simple statement (ie SELECT * FROM table). In my understanding the obj_id is anyhow faulty since there are no negative values of attrelid in pg_attribute. Running the statement primary_keys.sql with the proper value returns the requested row (table.id).

Thanks,
Holger

> Please try to replace the  \web\pgadmin\tools\sqleditor\templates\sqleditor\sql\default\primary_keys.sql file with the attached file and do not forget to take a backup of the original file.
> Restart the server and check the issue gets resolved or not.
 
 
--
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


--
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"