No Relations Found Error

Started by Carlos Mennensover 15 years ago6 messagesgeneral
Jump to latest
#1Carlos Mennens
carlos.mennens@gmail.com

I created today a new database and user for my Wiki. Now I created
both the db user and actual db as 'carlos' even though the owner of
the db 'wiki' is a user named 'wiki'. My user 'carlos' is a superuser
however. So I then wanted to view and change some data but I keep
getting this error:

carlos@wiki]:~$ psql -d wiki
psql (8.4.4)
Type "help" for help.

wiki=# \d
No relations found.

Anyone know what I am doing wrong?

#2Carlos Mennens
carlos.mennens@gmail.com
In reply to: Carlos Mennens (#1)
Re: No Relations Found Error

On Thu, Sep 30, 2010 at 3:31 PM, Raymond O'Donnell <rod@iol.ie> wrote:

Are the tables in a schema other than "public"? Enter "\dn" at the psql
prompt to see what schemas are there.

Perhaps not. I wasn't aware of that. When I created the database
before I created and tables, I used the following command:

"createlang plpgsql wiki"

Could that be why I don't see them?

wiki=# \dn
List of schemas
Name | Owner
--------------------+----------
information_schema | postgres
mediawiki | wiki
pg_catalog | postgres
pg_toast | postgres
pg_toast_temp_1 | postgres
public | postgres
(6 rows)

In reply to: Carlos Mennens (#2)
Re: No Relations Found Error

On 30/09/2010 20:33, Carlos Mennens wrote:

On Thu, Sep 30, 2010 at 3:31 PM, Raymond O'Donnell<rod@iol.ie> wrote:

Are the tables in a schema other than "public"? Enter "\dn" at the psql
prompt to see what schemas are there.

Perhaps not. I wasn't aware of that. When I created the database
before I created and tables, I used the following command:

"createlang plpgsql wiki"

Could that be why I don't see them?

No, not at all - that just installs the pl/pgsql language in the
database. However....

wiki=# \dn
List of schemas
Name | Owner
--------------------+----------
information_schema | postgres
mediawiki | wiki

...it looks as if MediaWiki has created a schema for itself during the
installation procedure, and that's where the tables and stuff are.

If you're not familiar with schemas, here's the section of the docs you
need to read:

http://www.postgresql.org/docs/9.0/static/ddl-schemas.html

Have a look at section 5.3.7 on the search path in particular, as this
will make your life much easier when using psql. :-)

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

In reply to: Raymond O'Donnell (#3)
Re: No Relations Found Error

On 30/09/2010 20:43, Raymond O'Donnell wrote:

http://www.postgresql.org/docs/9.0/static/ddl-schemas.html

Have a look at section 5.3.7 on the search path in particular, as this

Whoops, sorry - that's 5.7.3.

Ray..

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

#5Carlos Mennens
carlos.mennens@gmail.com
In reply to: Raymond O'Donnell (#4)
Re: No Relations Found Error

On Thu, Sep 30, 2010 at 3:44 PM, Raymond O'Donnell <rod@iol.ie> wrote:

On 30/09/2010 20:43, Raymond O'Donnell wrote:

http://www.postgresql.org/docs/9.0/static/ddl-schemas.html

Have a look at section 5.3.7 on the search path in particular, as this

Whoops, sorry - that's 5.7.3.

Thank you. I am reading the schema section you provided and it gives a
dry sense of what it does however I don't understand who I can access
the tables for the schema 'mediawiki'?

wiki=# \dn mediawiki
List of schemas
Name | Owner
-----------+-------
mediawiki | wiki
(1 row)

I can see the schema name and owner but what if I want to look inside?
Normally I would use the \d to view all the table info in the
connected database but now I can't do this in my 'wiki' database for
whatever reason. Perhaps because it was not created in the 'public'
schema rather than it's own custom schema.

wiki=# \c webmail
psql (8.4.4)
You are now connected to database "webmail".
webmail=# \d
List of relations
Schema | Name | Type | Owner
--------+---------------------+----------+---------
public | cache | table | webmail
public | cache_ids | sequence | webmail
public | contact_ids | sequence | webmail
public | contactgroupmembers | table | webmail
public | contactgroups | table | webmail
public | contactgroups_ids | sequence | webmail
public | contacts | table | webmail
public | identities | table | webmail
public | identity_ids | sequence | webmail
public | message_ids | sequence | webmail
public | messages | table | webmail
public | session | table | webmail
public | user_ids | sequence | webmail
public | users | table | webmail
(14 rows)

How would I achieve this on my 'wiki' database?

In reply to: Carlos Mennens (#5)
Re: No Relations Found Error

On 30/09/2010 20:59, Carlos Mennens wrote:

On Thu, Sep 30, 2010 at 3:44 PM, Raymond O'Donnell<rod@iol.ie> wrote:

On 30/09/2010 20:43, Raymond O'Donnell wrote:

http://www.postgresql.org/docs/9.0/static/ddl-schemas.html

Have a look at section 5.3.7 on the search path in particular, as this

Whoops, sorry - that's 5.7.3.

Thank you. I am reading the schema section you provided and it gives a
dry sense of what it does however I don't understand who I can access
the tables for the schema 'mediawiki'?

You can use a pattern in your \d commands, thus:

To see tables: \dt mediawiki.*
To see sequences: \ds mediawiki.*
etc....

You can also set the search path - see that bit in the docs.

\? is your friend here also.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie