pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [PHPLIB] SQL probs with phplib
4+ messages / 4 participants
[nested] [flat]
* Re: [PHPLIB] SQL probs with phplib
@ 1998-09-14 09:23 Szandor van Verseveld <verseveld@nederland.net>
0 siblings, 0 replies; 4+ messages in thread
From: Szandor van Verseveld @ 1998-09-14 09:23 UTC (permalink / raw)
To: Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>; pgsql-sql; phplib@shonline.de
I use the following to create the Postgres database:
CREATE TABLE active_sessions (
sid varchar(32) DEFAULT '' NOT NULL,
name varchar(32) DEFAULT '' NOT NULL,
val text,
changed varchar(14) DEFAULT '' NOT NULL
);
CREATE INDEX active_sessions_index ON active_sessions USING hash (sid
varchar_ops);
GRANT ALL ON active_sessions TO apache;
You can set the permissions to another user than apache.
Met vriendelijke groet,
Szandor van Verseveld
Nederland.Net
Icq: 14801584
-----Original Message-----
From: Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>; phplib@shonline.de
<phplib@shonline.de>
Date: maandag 14 september 1998 10:45
Subject: [PHPLIB] SQL probs with phplib
>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?)
>
>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'?)
>
>Having drawn a blank in searching list archives, I'd be grateful for any
>advice about what the correct pgsql versions of the above should be.
>
>NB: This is posted to two lists - I'm happy to summarise later if people
>don't want to xpost replies.
>
>Thanks,
>
>Oliver
>
>-
>PHP3 Base Library Mailing List. Send messages to <phplib@shonline.de>.
>To unsubscribe, send "unsubscribe" to <phplib-request@shonline.de> in
>the body, not the subject, of your message.
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [PHPLIB] SQL probs with phplib
@ 1998-09-14 09:28 Kristian Köhntopp <kk@shonline.de>
parent: Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>
1 sibling, 0 replies; 4+ messages in thread
From: Kristian Köhntopp @ 1998-09-14 09:28 UTC (permalink / raw)
To: Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>; +Cc: pgsql-sql; phplib@mail.shonline.de
Oliver Duke-Williams wrote:
> changed varchar(14) DEFAULT '' NOT NULL,
> ERROR: type name lookup of changed failed
changed is a regular varchar(14) and should be taken by Postgres without
problems. At least my Postgres did.
> ERROR: parser: Syntax error at or near "k_username"
Just don´t name that key (leave out the k_username). Alternatively
define the table without keys first and add the keys later using the
CREATE INDEX statement.
> Having drawn a blank in searching list archives, I'd be grateful
> for any advice about what the correct pgsql versions of the above
> should be.
Postgres support is new in release-5 of PHPLIB. There are not many
success reports with Postgres up to now. I am a MySQL type myself and
very new to Postgres...
Kristian
--
SH Online Dienst GmbH, Kristian Koehntopp,
Siemenswall, 24107 Kiel, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.shonline.de/ (GPL)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [SQL] SQL probs with phplib
@ 1998-09-14 20:10 David Hartwig <daybee@bellatlantic.net>
parent: Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>
1 sibling, 0 replies; 4+ messages in thread
From: David Hartwig @ 1998-09-14 20:10 UTC (permalink / raw)
To: Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>; +Cc: pgsql-sql; phplib@shonline.de
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* SQL probs with phplib
@ 1998-09-14 23:57 Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>
0 siblings, 2 replies; 4+ messages in thread
From: Oliver Duke-Williams @ 1998-09-14 23:57 UTC (permalink / raw)
To: pgsql-sql; phplib@shonline.de
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?)
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'?)
Having drawn a blank in searching list archives, I'd be grateful for any
advice about what the correct pgsql versions of the above should be.
NB: This is posted to two lists - I'm happy to summarise later if people
don't want to xpost replies.
Thanks,
Oliver
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~1998-09-14 23:57 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-09-14 09:23 Re: [PHPLIB] SQL probs with phplib Szandor van Verseveld <verseveld@nederland.net>
1998-09-14 23:57 SQL probs with phplib Oliver Duke-Williams <oduke@gisca.adelaide.edu.au>
1998-09-14 09:28 ` Kristian Köhntopp <kk@shonline.de>
1998-09-14 20:10 ` David Hartwig <daybee@bellatlantic.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox