Thread: Relation "pg_relcheck"

Relation "pg_relcheck"

From
"Victor Yegorov"
Date:
Hello.

I'm running PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.3.

I've created a table (a forest of nested sets):
create table forest ( tree_id int4 not null,leaf_id int4 not null,lid int2 not null check(lid > 0),rid int2 not null
check(rid > 1),relation_id int2 not null default 0,constraint forest_order check(lid < rid),constraint forest_primary
primarykey(tree_id, leaf_id)
 
);

Now, in psql:
mema2=> \d forest
ERROR:  Relation "pg_relcheck" does not exist

Whats the problem, I wonder. I've already created a new DB location with
initdb and pointed server to it - same stuff.




psql -E gives the following:

mema2=> \d forest
********* QUERY **********
SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules
FROM pg_class WHERE relname='forest'
**************************

********* QUERY **********
SELECT a.attname, format_type(a.atttypid, a.atttypmod), a.attnotnull,
a.atthasdef, a.attnum
FROM pg_class c, pg_attribute a
WHERE c.relname = 'forest'
AND a.attnum > 0 AND a.attrelid = c.oid
ORDER BY a.attnum
************************** 
********* QUERY **********
SELECT substring(d.adsrc for 128) FROM pg_attrdef d, pg_class c
WHERE c.relname = 'forest' AND c.oid = d.adrelid AND d.adnum = 5
************************** 
********* QUERY **********
SELECT c2.relname
FROM pg_class c, pg_class c2, pg_index i
WHERE c.relname = 'forest' AND c.oid = i.indrelid AND i.indexrelid =
c2.oid
AND NOT i.indisunique ORDER BY c2.relname
**************************

********* QUERY **********
SELECT c2.relname
FROM pg_class c, pg_class c2, pg_index i
WHERE c.relname = 'forest' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
AND i.indisprimary AND i.indisunique ORDER BY c2.relname
**************************

********* QUERY **********
SELECT c2.relname
FROM pg_class c, pg_class c2, pg_index i
WHERE c.relname = 'forest' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
AND NOT i.indisprimary AND i.indisunique ORDER BY c2.relname
**************************

********* QUERY **********
SELECT rcsrc, rcname
FROM pg_relcheck r, pg_class c
WHERE c.relname='forest' AND c.oid = r.rcrelid
**************************

ERROR:  Relation "pg_relcheck" does not exist
mema2=>


Hope to hear from you.

-- 

Victor Yegorov


Re: Relation "pg_relcheck"

From
"Victor Yegorov"
Date:
* Victor Yegorov <viy@pirmabanka.lv> [25.02.2003 18:06]:
> Hello.
> 
> I'm running PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.3.
> 
> I've created a table (a forest of nested sets):
> create table forest ( 
>     tree_id int4 not null,
>     leaf_id int4 not null,
>     lid int2 not null check(lid > 0),
>     rid int2 not null check (rid > 1),
>     relation_id int2 not null default 0,
>     constraint forest_order check(lid < rid),
>     constraint forest_primary primary key(tree_id, leaf_id)
> );
> 

Sorry for troubles, got the problem myself.
psql client was of version 7.2.2.
After update everything works fine.

-- 

Victor Yegorov


Re: Relation "pg_relcheck"

From
Stephan Szabo
Date:
On Tue, 25 Feb 2003, Victor Yegorov wrote:

> Hello.
>
> I'm running PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.3.
>
> I've created a table (a forest of nested sets):
> create table forest (
>     tree_id int4 not null,
>     leaf_id int4 not null,
>     lid int2 not null check(lid > 0),
>     rid int2 not null check (rid > 1),
>     relation_id int2 not null default 0,
>     constraint forest_order check(lid < rid),
>     constraint forest_primary primary key(tree_id, leaf_id)
> );
>
> Now, in psql:
> mema2=> \d forest
> ERROR:  Relation "pg_relcheck" does not exist
>
> Whats the problem, I wonder. I've already created a new DB location with
> initdb and pointed server to it - same stuff.

Are you sure you're using the same version of psql as the server is
running?  The info in pg_relcheck moved to pg_constraint IIRC.



Re: Relation "pg_relcheck"

From
Ian Barwick
Date:
On Tuesday 25 February 2003 16:50, Victor Yegorov wrote:
> Hello.
>
> I'm running PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.3.
>
> I've created a table (a forest of nested sets):
> create table forest (
>     tree_id int4 not null,
>     leaf_id int4 not null,
>     lid int2 not null check(lid > 0),
>     rid int2 not null check (rid > 1),
>     relation_id int2 not null default 0,
>     constraint forest_order check(lid < rid),
>     constraint forest_primary primary key(tree_id, leaf_id)
> );
>
> Now, in psql:
> mema2=> \d forest
> ERROR:  Relation "pg_relcheck" does not exist

You are probably using a pre-7.3 version of psql with a 7.3.x
backend.

Ian Barwick
barwick@gmx.net


Re: Relation "pg_relcheck"

From
Tom Lane
Date:
"Victor Yegorov" <viy@pirmabanka.lv> writes:
> mema2=> \d forest
> ERROR:  Relation "pg_relcheck" does not exist

> Whats the problem, I wonder.

psql version not matching server version.
        regards, tom lane


Re: Relation "pg_relcheck"

From
Rod Taylor
Date:
On Tue, 2003-02-25 at 10:50, Victor Yegorov wrote:
> Hello.
>
> I'm running PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.3.

The backend has been updated, but you're using an old version of the
psql client.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Re: Relation "pg_relcheck"

From
Tilo Schwarz
Date:
Tom Lane writes:
> "Victor Yegorov" <viy@pirmabanka.lv> writes:
> > mema2=> \d forest
> > ERROR:  Relation "pg_relcheck" does not exist
> >
> > Whats the problem, I wonder.
>
> psql version not matching server version.
>
>             regards, tom lane

Because this sort of questions appears quite often, I was wondering, if the
start up message of psql could be changed from


Welcome to psql 7.4devel, the PostgreSQL interactive terminal.


to something like


Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
Connected to PostgreSQL <put version here>.


to make it easier to catch these errors. Don't I get the server version with
"select version();"? (I would even try my first patch if folks would like
it...)

Best regards,
Tilo


Re: Relation "pg_relcheck"

From
Tom Lane
Date:
Tilo Schwarz <mail@tilo-schwarz.de> writes:
> Because this sort of questions appears quite often, I was wondering, if the 
> start up message of psql could be changed from 
>   Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
> to something like
>   Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
>   Connected to PostgreSQL <put version here>.
> to make it easier to catch these errors.

I'm not eager to add yet another hidden query cycle to the connection
startup overhead, especially not one that does nothing for people who
aren't making mistakes ;-).  What's been in the back of my mind is that
when we redesign the FE/BE protocol (real soon now, I hope) we should
extend the backend's first message to the frontend to include its
version number, as well as any other useful info we can think of
(database encoding and default client encoding come to mind).  This
would make it quite inexpensive to add the backend version to psql's
banner, as well as be a net savings in startup time now that libpq only
comes in a multibyte-enabled version.
        regards, tom lane


Re: Relation "pg_relcheck"

From
Bruce Momjian
Date:
Tom Lane wrote:
> Tilo Schwarz <mail@tilo-schwarz.de> writes:
> > Because this sort of questions appears quite often, I was wondering, if the 
> > start up message of psql could be changed from 
> >   Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
> > to something like
> >   Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
> >   Connected to PostgreSQL <put version here>.
> > to make it easier to catch these errors.
> 
> I'm not eager to add yet another hidden query cycle to the connection
> startup overhead, especially not one that does nothing for people who
> aren't making mistakes ;-).  What's been in the back of my mind is that
> when we redesign the FE/BE protocol (real soon now, I hope) we should
> extend the backend's first message to the frontend to include its
> version number, as well as any other useful info we can think of
> (database encoding and default client encoding come to mind).  This

Added to TODO:

>       o Report server version number, database encoding, client encoding

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073