Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select does not return values Postgres-11.4

I am using pgAdmin-4 and created a database with a single table, but select returns an error message: 'table oid'

I'm using a normal select query.

SELECT * FROM escola

This happens with PostgreSQL 11.4.

like image 244
Maykon Morais Avatar asked Jul 26 '19 20:07

Maykon Morais


People also ask

How do I select values in PostgreSQL?

If you want to select data from all the columns of the table, you can use an asterisk ( * ) shorthand instead of specifying all the column names. The select list may also contain expressions or literal values. Second, specify the name of the table from which you want to query data after the FROM keyword.

How does select query work in PostgreSQL?

After the PostgreSQL server receives a query from the client application, the text of the query is handed to the parser. The parser scans through the query and checks it for syntax errors. If the query is syntactically correct, the parser will transform the query text into a parse tree.

What does <> mean in PostgreSQL?

<> is the standard SQL operator meaning "not equal". Many databases, including postgresql, supports != as a synonym for <> . They're exactly the same in postgresql.

How do I do a wildcard search in PostgreSQL?

Use ILIKE : SELECT * FROM table WHERE columnName ILIKE 'R%'; or a case-insensitive regular expression: SELECT * FROM table WHERE columnName ~* '^R.


Video Answer


1 Answers

The problem is due to python3-psycopg2. The latest pgadmin4 version requires psycopg2-2.8. But if you're on Debian/Ubuntu stable, apt installed v2.7. So you need to update it with pip :

sudo pip3 install -U psycopg2

Then update the pgadmin4 config to add the local python path:

nano ~/.config/pgadmin/pgadmin4.conf 
# or with a right click on the system tray icon
# add /usr/local/lib/python3.6/dist-packages to the PythonPath.

Same thing with python3.7 (just change the lib path)

Hope this helps.

like image 142
vidlb Avatar answered Sep 27 '22 18:09

vidlb