HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

PostgreSQL no relations found

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqlfoundrelations

Problem

I am running ruby and rails app with postgresql database, and I want to do batch import from text file to the database.

I've configured the database and if I run psql and \l to list all databases, I can see it.

However, after I run rake db:migrate no relations are created in the database and running psql\d in order to check tables, says "No relations found". But the schema is created and I can see the tables in Induction PostgreSQL client (http://inductionapp.com)

Solution

The problem may be a namespace issue. You can \dn to list namespaces.

Keep in mind that by default \d only lists relations in the search path, and you can run show search_path to see what this is.

If you want to list relations in a namespace outside the search path, \d mynamespace.* will list them and their attributes. You can also:

set search_path = 'mynamespace';
\d
set search_path = 'public';


To temporarily change the search path for purposes of using \d

Code Snippets

set search_path = 'mynamespace';
\d
set search_path = 'public';

Context

StackExchange Database Administrators Q#36248, answer score: 6

Revisions (0)

No revisions yet.