Received: from trends.net (root@clio.trends.ca [209.47.148.2]) by hub.org (8.8.8/8.7.5) with ESMTP id WAA17810 for ; Mon, 14 Sep 1998 22:03:52 -0400 (EDT) Received: from iconmail.bellatlantic.net (iconmail.bellatlantic.net [199.173.162.30]) by trends.net (8.8.8/8.8.8) with ESMTP id VAA28875 for ; Mon, 14 Sep 1998 21:23:46 -0400 (EDT) Received: from bellatlantic.net (client-151-196-125-215.bellatlantic.net [151.196.125.215]) by iconmail.bellatlantic.net (IConNet Sendmail) with ESMTP id UAA10548; Mon, 14 Sep 1998 20:32:53 -0400 (EDT) Sender: postgres@iconmail.bellatlantic.net Message-ID: <35FD781A.BE5BF9A2@bellatlantic.net> Date: Mon, 14 Sep 1998 16:10:02 -0400 From: David Hartwig Organization: Insight Distribution Systems X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.29 i586) MIME-Version: 1.0 To: Oliver Duke-Williams CC: pgsql-sql@postgreSQL.org, phplib@shonline.de Subject: Re: [SQL] SQL probs with phplib References: <9809141757.ZM3032@tsg109.gisca.adelaide.edu.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Oliver Duke-Williams wrote: > Hi, > > I'm trying to set up phplib (release 5) for use with postgresql(6.3 I > _think_ but pg_version is empty, and I can't see an actual version > number anywhere... ), and having a couple of problems with the supplied > file create_database.sql (originally written with mySQL in mind). > > Specifically, in the first table created: > > CREATE TABLE active_sessions ( > sid varchar(32) DEFAULT '' NOT NULL, > name varchar(32) DEFAULT '' NOT NULL, > val text, > changed varchar(14) DEFAULT '' NOT NULL, > PRIMARY KEY (sid,name), > KEY changed (changed) > ); > > an error is reported: > > ERROR: type name lookup of changed failed > > (In postgres, do I need to go though a 'create type' process here?) > Try CREATE TABLE active_sessions ( sid varchar(32) DEFAULT '', name varchar(32) DEFAULT '', val text, changed varchar(14) DEFAULT '' NOT NULL, PRIMARY KEY (sid,name), ); CREATE [UNIQUE] INDEX {index_name} ON active_sessions USING btree(changed); -- NOT NULL is implied in a primary key > and in the second table: > > CREATE TABLE auth_user ( > uid varchar(32) DEFAULT '' NOT NULL, > username varchar(32) DEFAULT '' NOT NULL, > password varchar(32) DEFAULT '' NOT NULL, > perms varchar(255), > PRIMARY KEY (uid), > UNIQUE k_username (username) > ); > > the following error is generated: > > ERROR: parser: Syntax error at or near "k_username" > > (Will this need some additional command aling the lines of > 'create unique index'?) > And: CREATE TABLE auth_user ( uid varchar(32) PRIMARY KEY DEFAULT '', username varchar(32) DEFAULT '' NOT NULL, password varchar(32) DEFAULT '' NOT NULL, perms varchar(255) ); CREATE UNIQUE INDEX username_k ON auth_user USING btree(username); -- Though correct syntactically, a DEFAULT for any key column rarely makes good sense. -- \h create table -- at the psql prompt display allowable syntax