From: | "GRIMOIS Eric" <eric(dot)grimois(at)cpam-cergypontoise(dot)cnamts(dot)fr> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | SRF Functions don't want to return empty tuple |
Date: | 2003-09-29 16:18:00 |
Message-ID: | 003901c386a5$409c0b40$3d04a837@cpamcergypontoise.cnamts.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi
I have a problem with SRF functions on a RedHat 8.0 system with PostgreSQL
7.3.2.
Schema is following :
CREATE TABLE public.agents (
numero_age int4 NOT NULL,
nom_age varchar(30) NOT NULL,
prenom_age varchar(30) NOT NULL,
date_entree_age date NOT NULL,
identite varchar(50),
CONSTRAINT agents_pkey PRIMARY KEY (numero_age)
) WITH OIDS;
INSERT INTO public.agents VALUES (78888, 'PERAVIF', 'JO', '1967-06-18', '')
CREATE FUNCTION public.liste_agents(int4) RETURNS public.agents AS 'SELECT *
FROM agents WHERE numero_age = $1' LANGUAGE 'sql' VOLATILE;
When, I try :
SELECT * FROM liste_agents(78888)
Everything is Ok, I get my agent. But if I try :
SELECT * FROM liste_agents(0) (... or any other numero_age not in the
table...)
I get a error message :
ExecMakeTableFunctionResult: Invalid result from function returning tuple
What's wrong ? I guessed null values returned by the query didn't match
fields declared not null in the table schema, so I create a custom type
(with CREATE TYPE) but it neither doesn't work. Hint (?) : I've activated
Plpython for this Database.
Thanks
Eric GRIMOIS
Concepteur de logiciels
SEI - CPAM du Val d'Oise
From | Date | Subject | |
---|---|---|---|
Next Message | Kerv | 2003-09-29 16:19:21 | Thanks for all replies |
Previous Message | Achilleus Mantzios | 2003-09-29 15:46:44 | Conditional row grained + FK dependency oriented lazy replication |