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

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

[SQL] problem with casting

2001-02-14 Thread postgresql
I have a table that has a 'date' column. In psql I tried to do a select proofdate::text from openjobs where jobno = '10625'; responce:   can not cast type 'date' to 'text' Did i miss-read this section. I thought I could cast the date to text. has anyone seen this or am I missreading the docs?

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/

[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] Trigger question

2001-02-14 Thread Jan Wieck
Dave Wedwick wrote: > 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? Sample: CREATE TABLE t1 ( id serial PRIMARY KEY,

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 weapons/bombs

Re: [SQL] Re: Trigger question

2001-02-14 Thread Josh Berkus
Dave, Please look at the docs for creating triggers. (http:/www.postgresql.org/docs/). Hopefully, someone on this list with more experience with Update and Insert triggers can give you some help in avoiding the classic problems, such as infinite loops. Let me ask the obvious question: If the Ins

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] 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 Za

[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 trigge

Re: [SQL]how to select * from database1 table,database2 table

2001-02-14 Thread Josh Berkus
"guard": > if join database1 database2 > > how to make Folks, this really needs to be on a FAQ somewhere: PostgreSQL does not support inter-database Joins. Period. If you want to join tables from two different databases, I suggest that you use your front-end code to do so. I would also sugg

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 per

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 cr

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 functi

[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)

[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] 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] displaying constraints

2001-02-14 Thread Frank Joerdens
The only what that I am aware of in which you can display the constraints that have been created for a table is by dumping out the schema with the -s option and then trying to reconstruct the foreign key references from the triggers which where created by the e.g. some_column int4 references

[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.

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 b