Re: [SQL] constraint/restrict

2001-02-14 Thread Richard Huxton
From: "Olaf Marc Zanger" [EMAIL PROTECTED] hi there, with two tables i want to make some constraint-restrictions to make sure that now country-row is deleted if there is still a country_id in address table. e.g. address: 1, 2, ... country: 2, ... now country wouldn't be allowed to

[SQL] Oracle8 / PostgreSQL

2001-02-14 Thread Ines . Klimann
Hello, does someone know how I can do this in PostgreSQL ? (this is in Oracle8) : CREATE OR REPLACE TYPE adresse_type AS OBJECT (norue NUMBER, rue VARCHAR2(20), ville VARCHAR2(30), code_postal VARCHAR2(5)); / CREATE TABLE adresse OF adresse_type / Thanks, Ines.

[SQL] Trigger question

2001-02-14 Thread Dave Wedwick
Hi! I have a table with an int4 field called inserttime. Regardless of what the user enters in this field, I want a trigger to put now() into it. What's the syntax for the trigger? Thanks!

[SQL] createuser problem

2001-02-14 Thread fion yong
It gives the following error when i tried to a new user createuser demouser1Connection to database 'template1' failed.FATAL 1: SetUserId: user 'fion' is not in 'pg_shadow' how should i solve this problem?

[SQL] Trigger question

2001-02-14 Thread Dave Wedwick
Hi! I have a table with an int4 field called inserttime. Regardless of what the user enters in this field, I want a trigger to put now() into it. What's the syntax for the trigger? Thanks!

[SQL] How to create a type ?

2001-02-14 Thread Ines Klimann
Hello, I am trying to understand how works CREATE TYPE, but it seems to be too difficult for me... Can someone help me ? I have tried this : -- create function personne_in(text) returns personne as 'select $1;' language 'sql'; create function personne_out(text)

Re: [SQL] binary operators

2001-02-14 Thread Jaros³aw B³¹d
Frederic Metoz wrote: Hello, I am looking for the binary AND and OR ... SHIFT as well. Do they exist for postgresql ? Tanks, Fred In postgresql binary operators AND, OR ... don't exist, but you can simply extend postgresql by yours operators. You should use CREATE OPERATOR function. If

Re: [SQL] createuser problem

2001-02-14 Thread Oliver Elphick
"fion yong" wrote: It gives the following error when i tried to a new user createuser demouser1 Connection to database 'template1' failed. FATAL 1: SetUserId: user 'fion' is not in 'pg_shadow' how should i solve this problem? Become user postgres before you try to run

Re: [SQL] How to create a type ?

2001-02-14 Thread Tom Lane
Ines Klimann [EMAIL PROTECTED] writes: I have tried this : -- create function personne_in(text) returns personne as 'select $1;' language 'sql'; create function personne_out(text) returns text as 'select $1;' language 'sql'; create type personne (

[SQL] Re: Trigger question

2001-02-14 Thread Dave Wedwick
One person suggested setting now() as default. That would work sometimes, but I have a situation where the user program is updating the default field with 0. now() never gets into the field. So, regardless of what the user enters, I want now() to be updated, and I guess it would be via a

Re: [SQL] constraint/restrict

2001-02-14 Thread Jie Liang
add an foriegn key on address(country_id), let country(id) be a primary key. Jie LIANG St. Bernard Software Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.stbernard.com www.ipinc.com On Wed, 14 Feb 2001, Olaf Marc

Re: [SQL] createuser problem

2001-02-14 Thread Jie Liang
run this as user 'postgres' instead of 'fion' Jie LIANG St. Bernard Software Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.stbernard.com www.ipinc.com On Tue, 13 Feb 2001, fion yong wrote: It gives the following

Re: [SQL] How to create a type ?

2001-02-14 Thread Jie Liang
hope it helps. e.g. create function foo() returns setof varchar as ' select name from categories ' language 'sql'; db=# select foo() as name; name - recreation business web education questionable sex social society

[SQL] cannot create sequence

2001-02-14 Thread Olaf Marc Zanger
hi there, as it seems postgresql 7.0 has trouble to create ver_id_seq and own_id_seq there is nothing visible with \dt \ds \di are these names occupied for other use? thanks for help olaf -- soli-con Engineering Zanger, Dipl.-Ing. (FH) Olaf Marc Zanger Lorrainestrasse 23, 3013 Bern

Re: [SQL] cannot create sequence

2001-02-14 Thread Peter Eisentraut
Olaf Marc Zanger writes: as it seems postgresql 7.0 has trouble to create ver_id_seq Define "trouble". -- Peter Eisentraut [EMAIL PROTECTED] http://yi.org/peter-e/

Re: [SQL] cannot create sequence

2001-02-14 Thread Olaf Zanger
hi there, trouble means: it doesn't show ver_id_seq, nor own_id_seq when doing a \ds but it brings up an error "cannot create sequence) if i want to create table ver (id serial, ...); this happend after i mistakenly did create table cng (id serial, ver_id int4 constraint ver_id_cst reference

Re: [SQL] cannot create sequence

2001-02-14 Thread Tom Lane
Olaf Zanger [EMAIL PROTECTED] writes: it doesn't show ver_id_seq, nor own_id_seq when doing a \ds but it brings up an error "cannot create sequence) if i want to create table ver (id serial, ...); What is the *exact* text of the error message? (That ain't it.) I am guessing that a Unix