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

"Holger Kopp-Musick" <[email protected]> Wed, 4 Sep 2019 09:20:20 +0200
Newsgroups gmane.comp.db.postgresql.pgadmin
Message-ID <trinity-61a782b2-ade3-4eef-8fe8-1e6eef0acab9-1567581620511@3c-app-gmx-bs63>
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.
pgadmin4_20190904_01.log (application/octet-stream, 2.4 KB)
2019-09-04 08:22:50,655: ERROR	flask.app:	Failed to execute query (execute_dict) for the server #8- CONN:416567 (Query-id: 8922745):
Error Message:FEHLER:  Operator existiert nicht: - oid
LINE 3: WHERE attrelid=-582661259::oid AND attnum = ANY (
                       ^
HINT:  Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen.

2019-09-04 08:22:50,655: ERROR	flask.app:	FEHLER:  Operator existiert nicht: - oid
LINE 3: WHERE attrelid=-582661259::oid AND attnum = ANY (
                       ^
HINT:  Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen.
Traceback (most recent call last):
  File "C:/Program Files (x86)/pgAdmin 4/v4/venv/Lib/site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:/Program Files (x86)/pgAdmin 4/v4/venv/Lib/site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:/Program Files (x86)/pgAdmin 4/v4/venv/Lib/site-packages\flask_login\utils.py", line 261, in decorated_view
    return func(*args, **kwargs)
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\tools\sqleditor\__init__.py", line 416, in poll
    if trans_obj.check_updatable_results_pkeys_oids():
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\tools\sqleditor\command.py", line 910, in check_updatable_results_pkeys_oids
    pk_names, table_oid = is_query_resultset_updatable(conn, sql_path)
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\tools\sqleditor\utils\is_query_resultset_updatable.py", line 50, in is_query_resultset_updatable
    sql_path=sql_path)
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\tools\sqleditor\utils\is_query_resultset_updatable.py", line 112, in _check_primary_keys
    sql_path=sql_path)
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\tools\sqleditor\utils\is_query_resultset_updatable.py", line 146, in _get_primary_keys
    raise Exception(result)
Exception: FEHLER:  Operator existiert nicht: - oid
LINE 3: WHERE attrelid=-582661259::oid AND attnum = ANY (
                       ^
HINT:  Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen.