question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PostgreSQL: database switch problem

See original GitHub issue

I dont know if it’s a bug or a misunderstanding of the gui. I have a postgresql database with one table dataimport. I open dbeaver, set active the database, run a select on the table without problem. If I open a new sql editor and run the same query, I get “relation dataimport does not exist”. The new editor doesnt seem to be connected to the right database ???

dbeaver-debug.log

2017-02-24 12:26:04.051 - DBeaver 4.0.0 is starting
2017-02-24 12:26:04.062 - Install path: '/usr/share/dbeaver'
2017-02-24 12:26:04.062 - Instance path: 'file:/home/christophe/.dbeaver4/'
2017-02-24 12:26:04.063 - Memory available 75Mb/871Mb
2017-02-24 12:26:04.094 - Starting RMI server at 64462
2017-02-24 12:26:04.348 - Create display
2017-02-24 12:26:04.439 - Run workbench
2017-02-24 12:26:08.476 - Initializing DBeaver 4.0.0
2017-02-24 12:26:08.493 - Host plugin: org.jkiss.dbeaver.core.application 4.0.0
2017-02-24 12:26:08.505 - Initialize Core...
2017-02-24 12:26:09.005 - Core initialized (500ms)
2017-02-24 12:26:09.013 - Configure workbench window
2017-02-24 12:26:09.211 - Create actions
2017-02-24 12:26:09.220 - Disable Eclipse action set 'org.eclipse.ui.edit.text.actionSet.annotationNavigation'
2017-02-24 12:26:09.224 - Disable Eclipse action set 'org.eclipse.ui.edit.text.actionSet.navigation'
2017-02-24 12:26:09.230 - Disable Eclipse action set 'org.eclipse.ui.WorkingSetActionSet'
2017-02-24 12:26:09.980 - Initialize workbench window
2017-02-24 12:26:10.071 - Finish initialization
2017-02-24 12:26:12.700 - Connect with 'narvalo' (postgres-jdbc-15a386bc619-7c48af1750a3062)
2017-02-24 12:26:13.423 - Connected (postgres-jdbc-15a386bc619-7c48af1750a3062)
2017-02-24 12:26:55.798 - null
org.jkiss.dbeaver.model.exec.DBCException: SQL Error [42P01]: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:140)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:343)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.extractData(SQLQueryJob.java:707)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:1752)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:91)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:137)
	... 6 more
2017-02-24 12:30:15.432 - null
org.jkiss.dbeaver.model.exec.DBCException: SQL Error [42P01]: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:140)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:343)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.extractData(SQLQueryJob.java:707)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:1752)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:91)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:137)
	... 6 more

.log

!SESSION 2017-02-24 12:26:01.644 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_121
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.jkiss.dbeaver.model 4 0 2017-02-24 12:26:55.813
!MESSAGE SQL Error [42P01]: ERROR: relation "dataimport" does not exist
  Position: 15
!STACK 0
org.jkiss.dbeaver.model.exec.DBCException: SQL Error [42P01]: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:140)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:343)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.extractData(SQLQueryJob.java:707)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:1752)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:91)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:137)
	... 6 more
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2017-02-24 12:26:55.814
!MESSAGE ERROR: relation "dataimport" does not exist
  Position: 15
!STACK 0
org.postgresql.util.PSQLException: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:137)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:343)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.extractData(SQLQueryJob.java:707)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:1752)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:91)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

!ENTRY org.jkiss.dbeaver.model 4 0 2017-02-24 12:30:15.448
!MESSAGE SQL Error [42P01]: ERROR: relation "dataimport" does not exist
  Position: 15
!STACK 0
org.jkiss.dbeaver.model.exec.DBCException: SQL Error [42P01]: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:140)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:343)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.extractData(SQLQueryJob.java:707)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:1752)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:91)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:137)
	... 6 more
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2017-02-24 12:30:15.448
!MESSAGE ERROR: relation "dataimport" does not exist
  Position: 15
!STACK 0
org.postgresql.util.PSQLException: ERROR: relation "dataimport" does not exist
  Position: 15
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:137)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:343)
	at org.jkiss.dbeaver.runtime.sql.SQLQueryJob.extractData(SQLQueryJob.java:707)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:1752)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:91)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:33 (14 by maintainers)

github_iconTop GitHub Comments

5reactions
serge-ridercommented, Dec 5, 2018

This is a typical confusing thing about PG connections. In db navigator you can see all databases (by default) but only one of them is active (it is bold). When you write your queries in SQL editor they may operate only with schemas/tables in the active database. You need to switch to another database (right click->Set active) to be able to query it.

Agreed, this is not very obvious. But this is how PostgreSQL database works. Do you have any ideas how to handle this better in UI?

3reactions
serge-ridercommented, Feb 24, 2017

Can’t reproduce.

  1. Make sure you have correct active schema in main toolbar.
  2. Open Query Manager view, enable all object types and all query types checkboxes in preferences. Now you can see what internal SQL is executed by DBeaver. There should be some SET search_path query. Check that it is correct.
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to switch databases in psql? - postgresql - Stack Overflow
Run psql in command line, it will switch to default database; psql anotherdb , it will switch to the db with the name...
Read more >
Listing and Switching Databases in PostgreSQL - Liquid Web
Type "help" for help. Switching between databases is another way of saying you are closing one connection and opening another.
Read more >
10 Common PostgreSQL Errors - Percona
It's very simple to switch the unprivileged user using us and initdb the cluster. You cannot “initdb” using superuser, so change the user...
Read more >
Documentation: 15: psql - PostgreSQL
psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query...
Read more >
Chapter 27. High Availability, Load Balancing, and Replication
This synchronization problem is the fundamental difficulty for servers working together. Because there is no single solution that eliminates the impact of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found