Here is a little SQL story I wrote for myself :-)
create table person (name text );
CREATE
create table book (title text, author person);
CREATE
insert into person values ('nicolas');
INSERT 692344 1
insert into person values ('julien');
INSERT 692345 1
create function person_named(text) returns person
as 'select * from person where name = $1'
language 'sql';
CREATE
insert into book values ('ma vie', person_named('nicolas'));
INSERT 692347 1
insert into book values ('mon fils', person_named('nicolas'));
INSERT 692348 1
insert into book values ('mon pere', person_named('julien'));
INSERT 692349 1
select * from book where name(author) = 'nicolas';
NOTICE: An operand to the '=' operator returns a set of text,
ERROR: but '=' takes single values, not sets.
create function is_person_named(person,text) returns bool
as 'select $1.name = $2'
language 'sql';
CREATE
select * from book where is_person_named(author, 'nicolas');
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
This probably means the backend terminated abnormally before or
while processing the request.
On the other hand, when I switch back to the terminal from which I sent postmaster, there is a message :
NOTICE : Message from PostgreSQL backend:
The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory.
I have rolled back the current transaction and am going to terminate your database system connection and exit.
Please reconnect to the dsatabase system and repeat your query.
As far as I am concern, I just want to define a table with a column of another table, insert rows in it, and select
rows with this column having particular attribute values (like : select * from book where author.name = 'nicolas';).
The process described above shows me that it not easy to do this.
The abortion of the process during the last query appears to be anything but normal, am I wrong ?
I'm running PostgreSQL V6.3.2 on a linux box with a 2.0.30 kernel.
Can someone tell me more ? Am I sending in the right list ?
Thank you all
Nicolas
--
Nicolas Caillaud
Nicolas.Caillaud@mail.dotcom.fr