Обсуждение: newbie problem on creating table
I am trying to get a start with Postgres 6.4 on Suse Linux 6.4. I created a superuser who is allowed to create databases. I created a user and a database, but I didn't manage so far to create a table. It just returns "Error cannot create <tablename>. In the configuration file for the authentication, I used the settings coming with the installation: local all trust hosts all 127.0.0.1 255.255.255.255 trust The logfile also just shows the messages: Error: Cannot create <table> AbortCurrentTx .... I am really stuck and have no glue where to look or to start. Any help is highly welcome thomas PS: posted to pgsql-novice and pgsql-general
Are you able to show the systemtables from psql prompt ? What looks your create table statement like ? As which user did you create the database and as who you are logged in (System/database) ? cs > I am trying to get a start with Postgres 6.4 on Suse Linux 6.4. I created a > superuser who is allowed to create databases. I created a user and a > database, but I didn't manage so far to create a table. It just returns > "Error cannot create <tablename>. > In the configuration file for the authentication, I used the settings coming > with the installation: > > local all trust > hosts all 127.0.0.1 255.255.255.255 trust > > The logfile also just shows the messages: > Error: Cannot create <table> > AbortCurrentTx > .... > > I am really stuck and have no glue where to look or to start. Any help is > highly welcome > > thomas > > PS: posted to pgsql-novice and pgsql-general
> >I am trying to get a start with Postgres 6.4 on Suse Linux 6.4. > I did that just 2 weeks ago. and it works? > >I created a superuser who is allowed to create databases.I created a > >user and a database, but I didn't manage so far to create a table. > like : $ psql -c "create table test ( a int, b int )" yes, I tried exactly this statement, but still the same error > > It just returns "Error cannot create <tablename>. > Did you install the pg_datab and pg_ifa packages, too ? yes, I installed both packages > >In the configuration file for the authentication, I used the settings coming > >with the installation: > > > >local all trust > >hosts all 127.0.0.1 255.255.255.255 trust > > > >The logfile also just shows the messages: > >Error: Cannot create <table> > >AbortCurrentTx > >.... > > > >I am really stuck and have no glue where to look or to start. Any help is > >highly welcome > Well, glue won't help you to become unstuck :-) I take whatever it needs to get this fixed :-) > >thomas > > > >PS: posted to pgsql-novice and pgsql-general > > > > > -- > Bernd Tegge mailto:tegge@repas-aeg.de > Tel: ++49-511-87449-12 repas AEG Automation GmbH > Fax: ++49-511-87449-20 GS Hannover, Germany > >
> > > > I am trying to get a start with Postgres 6.4 on Suse Linux 6.4. I created a > > superuser who is allowed to create databases. I created a user and a > > database, but I didn't manage so far to create a table. It just returns > > "Error cannot create <tablename>. > > The owner of your database might the postgres superuser. You will have > to set the permissions or the owner accordingly. The latter can be > done in 7.0.x as superuser with: > > UPDATE pg_database > SET datdba=<uid of new user> > WHERE datname=<name of db in question> > ; I checked pg_database: The datadba for the database is root and I am accessing the database as root. any other ideas? > > HTH > Holger Klawitter > -- > Holger Klawitter +49 (0)251 484 0637 > holger@klawitter.de http://www.klawitter.de/ > >
> >> >I am trying to get a start with Postgres 6.4 on Suse Linux 6.4.
> >> I did that just 2 weeks ago.
> >
> >and it works?
> yes, no problems :
> root@hanlrs:/tmp > su -- postgres
> postgres@hanlrs:/tmp > PATH=$PATH:/usr/lib/pgsql/bin
> postgres@hanlrs:/tmp > createuser
> Enter name of user to add: root
> Shall the new user be allowed to create databases? (y/n) y
> Shall the new user be allowed to create more new users? (y/n) y
> CREATE USER
> postgres@hanlrs:/tmp > exit
> root@hanlrs:/tmp > createuser nobody
> Shall the new user be allowed to create databases? (y/n) y
> Shall the new user be allowed to create more new users? (y/n) n
> CREATE USER
> root@hanlrs:/tmp > su -- nobody
> nobody@hanlrs:/tmp > PATH=$PATH:/usr/lib/pgsql/bin
> nobody@hanlrs:/tmp > createdb test
> CREATE DATABASE
> nobody@hanlrs:/tmp > psql -dtest -c "create table test1( a int)"
> CREATE
> nobody@hanlrs:/tmp > psql -dtest
> Welcome to psql, the PostgreSQL interactive terminal.
>
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help on internal slash commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> test=> insert into test1 values (1);
> INSERT 621408 1
> test=> select * from test1
> test-> \g
> a
> ---
> 1
> (1 row)
>
> test=>
I deinstalled and installed postgres and executed exactly the same
statements as you, and it worked. One thing I am not sure about is during
creation of a user, I am asked whether to use a postgres ID or UNIX ID, what
is the right/recommended approach (I used UNIX ID).
Then I created a new database "castortest". I tried to execute a file
creating a schema with a bunch of tables and index definitions with
psql -dcastortest -f create.sql
This returned an error with the first create table statement. Any attempt
after that, even after reboot, to create a table failed.
Below is the postgresql.log file
-----
TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
Line: 446)
!(((bool) (UserId != 0))) (0) [Unpassender IOCTL (I/O-Control) für das
Gerät]
ERROR: cannot create prod
ERROR: DefineIndex: prod relation not found
TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
Line: 446)
!(((bool) (UserId != 0))) (0) [Unpassender IOCTL (I/O-Control) für das
Gerät]
ERROR: cannot create prod
TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
Line: 446)
!(((bool) (UserId != 0))) (0) [Unpassender IOCTL (I/O-Control) für das
Gerät]
TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
Line: 446)
!(((bool) (UserId != 0))) (0) [Unpassender IOCTL (I/O-Control) für das
Gerät]
ERROR: cannot create test2
ERROR: test2: Table does not exist.
TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
Line: 446)
!(((bool) (UserId != 0))) (0) [Unpassender IOCTL (I/O-Control) für das
Gerät]
> --
> Bernd Tegge mailto:tegge@repas-aeg.de
> Tel: ++49-511-87449-12 repas AEG Automation GmbH
> Fax: ++49-511-87449-20 GS Hannover, Germany
>
>
"Thomas Krebs" <thomas@krebs-haertl.de> writes:
> TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
> Line: 446)
I think what's causing this is that you can't use zero as a Postgres
userid. Unfortunately createuser doesn't enforce that restriction;
I'll see about fixing that oversight for 7.1.
regards, tom lane