From: | "Ismael (dot)(dot)(dot)(dot)" <ismaelpsp(at)hotmail(dot)com> |
---|---|
To: | "Rhys A(dot)D(dot) Stewart" <rhys(dot)stewart(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: in query variables.... |
Date: | 2008-07-17 20:30:53 |
Message-ID: | BLU103-W3329FBCB989E6AB4A46DB9A38E0@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>
> Hi all,
>
> this is from the is there a way file.
> Is there a way to get the name of the relation or relations in a query
> from within the query? Like some kind of magic variable...?
> for example :
> "select *, from thistable"
> where would be replaced by thistable.
>
>
> Rhys
> Peace & Love|Live Long & Prosper
>
No as far as I know, but you can create a stored procedure and pass
as parameter the table and then "create" your own query and
execute it from within the stored procedure
http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html
EXECUTE 'UPDATE '|| some_magic_variable || ' SET '
|| quote_ident(colname)
|| ' = '
|| quote_literal(newvalue)
|| ' WHERE key = '
|| quote_literal(keyvalue);
I haven't tried it thought.
_________________________________________________________________
Tenemos lo que búscas…JUEGOS.
http://club.prodigymsn.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-07-17 20:48:49 | Re: in query variables.... |
Previous Message | Ismael .... | 2008-07-17 20:22:49 | Re: deleting the master but not the detail |