Re: [SQL] Conditional rule?

2000-07-27 Thread Jan Wieck
Tom Lane wrote: > "=?iso-8859-1?B?QW5kcukgTuZzcw==?=" <[EMAIL PROTECTED]> writes: > > I wish to make rule looking something like this: > > create rule newsrule as > > on insert to news do > > if new.publishtime is not null insert into news_unpublished > > values(new.id); > > > I.e. "On an in

Re: [SQL] Conditional rule?

2000-07-27 Thread Robert B. Easter
On Thu, 27 Jul 2000, Robert B. Easter wrote: > On Thu, 27 Jul 2000, André Næss wrote: > > I've been looking through the material I have on postgreSQL, but can't seem > > to find an answer to my problem. Very simplied, my tables are something like > > this: > > > > create table news ( > >id se

Re: [SQL] Conditional rule?

2000-07-27 Thread Robert B. Easter
On Thu, 27 Jul 2000, André Næss wrote: > I've been looking through the material I have on postgreSQL, but can't seem > to find an answer to my problem. Very simplied, my tables are something like > this: > > create table news ( >id serial, >story text, >publishtime timestamp > ) > >

[SQL] BLOBs

2000-07-27 Thread Bernie Huang
Hi, everyone, Browsing through the online manual, I didn't find anything related to BLOBs, but I know there must be BLOBs since many people are asking about it on the list and there is a pg_fetch_object() in PHP for Postgres. Could anyone points me an URL where I can look it up? Thanks. -Berni

Re: [SQL] Conditional rule?

2000-07-27 Thread André Næss
Ooops... seems I had a rule tied to my news table which caused the malfunction, sorry if I wasted anyone's time :( André Næss - Original Message - From: "André Næss" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 27, 2000 7:21 PM Subject: Re: [SQL] Conditional rule?

Re: [SQL] Conditional rule?

2000-07-27 Thread André Næss
Hm... I'm a true newbie when it comes to plpgsql and triggers, but I looked through some texts and managed to come up with the following rather odd (to me at least) behaviour: * create table news ( id serial, title varchar(50), time timestamp ) create table news_un ( news_id int )

Re: [SQL] Conditional rule?

2000-07-27 Thread Tom Lane
"=?iso-8859-1?B?QW5kcukgTuZzcw==?=" <[EMAIL PROTECTED]> writes: > I wish to make rule looking something like this: > create rule newsrule as > on insert to news do > if new.publishtime is not null insert into news_unpublished > values(new.id); > I.e. "On an insert to news, if new.publish is

[SQL] Automatic Deletes?

2000-07-27 Thread Itai Zukerman
Hi, I have: CREATE TABLE a ( id SERIAL, val INT4 ) ; I would like to create some rules to keep "a" free from rows where val == 0. Something like: CREATE RULE a_insert AS ON INSERT TO a WHERE NEW.val = 0 DO INSTEAD NOTHING ; CREATE RULE a_update AS ON UPDATE TO a WHERE NEW.val =

Re: [SQL] Conditional rule?

2000-07-27 Thread Itai Zukerman
> I.e. "On an insert to news, if new.publish is not null, insert the new > post's id into news_unpublished. How about: CREATE RULE newsrule AS ON INSERT TO news DO INSERT INTO news_unpublished SELECT NEW.id WHERE NEW.publishtime IS NOT NULL -itai

[SQL] Conditional rule?

2000-07-27 Thread André Næss
I've been looking through the material I have on postgreSQL, but can't seem to find an answer to my problem. Very simplied, my tables are something like this: create table news ( id serial, story text, publishtime timestamp ) create table news_unpublished ( news_id ) I wish to make r

[SQL] Aggregates and Primary Keys

2000-07-27 Thread Itai Zukerman
Hi, I have this: create table a ( x int4 primary key, dat int4, count int4 ) ; create table b ( x int4 references a(x), count int4 ) ; insert into a values ( 1, 1, 10 ) ; insert into a values ( 2, 2, 20 ) ; insert into b values ( 1, 2 ) ; insert into b values ( 1, 3 ) ; insert int

[SQL] Compile

2000-07-27 Thread Jerome Raupach
I must compile my program (who is accessing to DB) with g++, but his methods are using by another program who is compiling in CC. how do i ? thanks.

RE: Re(2): [SQL] optimize sql

2000-07-27 Thread Henry Lafleur
If you know that 't' will always be the highest character in the active field for all records: SELECT name FROM office, office_application WHERE code = office_code GROUP BY name HAVING MAX(active) < 't' Of course, if you have an active that is 'z' for example, then this won't work. I think this

Antw: Re: [SQL] Large text insertion

2000-07-27 Thread Gerhard Dieringer
>>> [EMAIL PROTECTED] 27.07.2000 11.39 Uhr >>> >7.1 will be able to hold megabytes in the "text" data type. >It's already in the CURRENT sources and works well. Is there a release date visible at the horizon? Gerhard

Re: [SQL] Large text insertion

2000-07-27 Thread Jan Wieck
Vladimir Terziev wrote: > >Can anybody tell me, how I can insert text data larger then 20k in database > wihtout using large objects? > 7.1 will be able to hold megabytes in the "text" data type. It's already in the CURRENT sources and works well. Jan -- #===

Re: [SQL] Classes, Inheritance, and Children

2000-07-27 Thread Oliver Elphick
Thomas Swan wrote: >I think I may have asked this before... If I did I'm sorry, but maybe this >attempt, assuming a prior one, may be a little more clear. > >create table foo (id int8); >create table bar1 (name text) inherits (foo); >create table bar2 (data text) inherits (foo); >cr

[SQL] Large text insertion

2000-07-27 Thread Vladimir Terziev
Can anybody tell me, how I can insert text data larger then 20k in database wihtout using large objects?

[SQL] Classes, Inheritance, and Children

2000-07-27 Thread Thomas Swan
I think I may have asked this before... If I did I'm sorry, but maybe this attempt, assuming a prior one, may be a little more clear. create table foo (id int8); create table bar1 (name text) inherits (foo); create table bar2 (data text) inherits (foo); create table hybrid ( ) inherits (bar1, ba