knowledge-database (beta)

Current group: pgsql.novice

Re: Common question: what's wrong

Re: Common question: what's wrong  
Adie
 Sql query as input variable in a PL/pgsql function?  
Tjibbe Rijpma
 Re: Sql query as input variable in a PL/pgsql function?  
Sean Davis
From:Adie
Subject:Re: Common question: what's wrong
Date:Mon, 17 Jan 2005 13:22:23 +0100 (CET)

Thank to Terry I've tried to write rule instead of trigger but have
another problem.

CREATE RULE g_oferty_id_oferty_rule AS ON INSERT TO g_oferty WHERE
(new.id_oferta IS NULL) DO INSTEAD INSERT INTO g_oferty (id_oferta, ...)
VALUES (DEFAULT, new.d..);

But got ' infinite recursion detected in rules for relation "g_oferty" '
error. The second insert should not fire this Rule...


Martin

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
From:Tjibbe Rijpma
Subject:Sql query as input variable in a PL/pgsql function?
Date:Mon, 17 Jan 2005 14:33:41 +0100
Is is possible to maka a PL/pgsql function which can receive a random SQL
query as input variable?

Like this:

SELECT save_query ('SELECT * FROM objects, names WHERE objects.id =
names.id);

And than execute the SQL query inside the function.

Tjibbe


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From:Sean Davis
Subject:Re: Sql query as input variable in a PL/pgsql function?
Date:Mon, 17 Jan 2005 08:58:02 -0500
See this section of the manual:

http://wwwmaster.postgresql.org/docs/7.4/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Sean

----- Original Message -----
From: "Tjibbe Rijpma"
To: "PostgreSQL Novice"
Sent: Monday, January 17, 2005 8:33 AM
Subject: [NOVICE] Sql query as input variable in a PL/pgsql function?


> Is is possible to maka a PL/pgsql function which can receive a random SQL
> query as input variable?
>
> Like this:
>
> SELECT save_query ('SELECT * FROM objects, names WHERE objects.id =
> names.id);
>
> And than execute the SQL query inside the function.
>
> Tjibbe
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
   

Copyright © 2006 knowledge-database   -   All rights reserved