Discussion:
pg_user does not exist
(too old to reply)
Bethany A.Benzur
2004-02-18 00:01:31 UTC
Permalink
Hello,
I have been running postgres for quite some time with this problem:
whenever a user logs in or issues almost any command in the "psql"
client, they get this error:

-bash-2.05b$ psql
ERROR: Relation "pg_user" does not exist

postgres=> \l
ERROR: Relation "pg_user" does not exist

postgres=> \dt
ERROR: Relation "pg_user" does not exist

etc...

At first I thought it had something to do with my using ident
authentication, but after some research it seems my "template1"
database is corrupt and missing some pretty essential elements. If I
could just build a new template1 or run initdb again, everything might
be OK... but the problem here is that there isn't much I can do without
being able to use pg_dump to export/backup my databases first!!

I even tried editing the initdb script and the postgres.bki file to
only run certain parts of the init process, like creating the views and
such... which DID eliminate the "pg_user does not exist" error, but
also created big messes with the other databases (like creating
multiple pg_database tables and erasing all other database's data).
Oops! Luckily restoring was as easy as "mv data.bak data" . :)

So, before I spend any more time playing with the my customized initdb
and postgres.bki, does anyone have any better ideas of how I might:

a) rebuild template1 to get to a point where I can pg_dump my
databases, reinstall postgres or re-initdb, then import the databases
-OR-
b) export the databases without having a pg_user view??

The server is running:
Redhat 8.0
postgresql-7.2.4-5.80

I'm not even sure if I'm on the right track here, so any help is much
appreciated!!
B.
--
Bethany A. Benzur
Computer Support Specialist IV
School of Literature, Communication, and Culture at Georgia Institute
of Technology
phone: 404.894.7632
helpdesk: lcc-***@iac.gatech.edu


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
Tom Lane
2004-02-18 04:06:00 UTC
Permalink
Post by Bethany A.Benzur
whenever a user logs in or issues almost any command in the "psql"
-bash-2.05b$ psql
ERROR: Relation "pg_user" does not exist
Hmmm ... I'm wondering about version mismatches between your psql and
your backend. Does "psql -V" agree with the backend version?
Post by Bethany A.Benzur
At first I thought it had something to do with my using ident
authentication, but after some research it seems my "template1"
database is corrupt and missing some pretty essential elements. If I
could just build a new template1 or run initdb again, everything might
be OK... but the problem here is that there isn't much I can do without
being able to use pg_dump to export/backup my databases first!!
You can rebuild template1 from template0 (... that's pretty much why
template0 exists...). There are some gotchas in this process, see this
link for a walkthrough:
http://techdocs.postgresql.org/techdocs/pgsqladventuresep1.php

However, I am not totally convinced that that's where your problem is.
Do you see failures when you are connected to other databases besides
template1?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Bethany A.Benzur
2004-02-18 14:10:18 UTC
Permalink
Post by Tom Lane
Hmmm ... I'm wondering about version mismatches between your psql and
your backend. Does "psql -V" agree with the backend version?
[***@steel ]$ psql -V
psql (PostgreSQL) 7.2.4
Post by Tom Lane
However, I am not totally convinced that that's where your problem is.
Do you see failures when you are connected to other databases besides
template1?
Yes, the same "pg_user does not exist" occurs with each database (hence
my not being able to dump + restore). I assume that is the case because
each database is based off of template1 when it is created.

I will try reconstructing template1 from template0 - thanks for that
link!

this a great start - thanks!
B.

--
Bethany A. Benzur
Computer Support Specialist IV
School of Literature, Communication, and Culture at Georgia Institute
of Technology
phone: 404.894.7632
helpdesk: lcc-***@iac.gatech.edu


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Bethany A.Benzur
2004-02-18 18:49:39 UTC
Permalink
Argg... I guess I won't be rebuilding template1 from template0 seeing
as I have no template0!! :(

template1=> UPDATE pg_database SET datallowconn = TRUE
template1-> WHERE datname = 'template0';
UPDATE 0

I'm running out of ideas here... how will I get my databases out and
back in without pg_dump?
Post by Bethany A.Benzur
Post by Tom Lane
Hmmm ... I'm wondering about version mismatches between your psql and
your backend. Does "psql -V" agree with the backend version?
psql (PostgreSQL) 7.2.4
Post by Tom Lane
However, I am not totally convinced that that's where your problem is.
Do you see failures when you are connected to other databases besides
template1?
Yes, the same "pg_user does not exist" occurs with each database
(hence my not being able to dump + restore). I assume that is the case
because each database is based off of template1 when it is created.
I will try reconstructing template1 from template0 - thanks for that
link!
this a great start - thanks!
B.
--
Bethany A. Benzur
Computer Support Specialist IV
School of Literature, Communication, and Culture at Georgia Institute
of Technology
phone: 404.894.7632
---------------------------(end of
broadcast)---------------------------
TIP 8: explain analyze is your friend
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
Tom Lane
2004-02-22 23:04:02 UTC
Permalink
Post by Bethany A.Benzur
Argg... I guess I won't be rebuilding template1 from template0 seeing
as I have no template0!! :(
template1=> UPDATE pg_database SET datallowconn = TRUE
template1-> WHERE datname = 'template0';
UPDATE 0
Hm. I'm beginning to think you've got a transaction counter wraparound
issue. What filenames do you have in $PGDATA/pg_clog/ ? How long has
this database been running, and have you been doing full-database
VACUUMs at regular intervals? (See the "routine maintenance" section of
the Admin Guide for background.)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Loading...