Re: in query variables.... - Mailing list pgsql-general

From Ismael ....
Subject Re: in query variables....
Date
Msg-id BLU103-W3329FBCB989E6AB4A46DB9A38E0@phx.gbl
Whole thread Raw
In response to in query variables....  ("Rhys A.D. Stewart" <rhys.stewart@gmail.com>)
List 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/

pgsql-general by date:

Previous
From: "Ismael ...."
Date:
Subject: Re: deleting the master but not the detail
Next
From: Alvaro Herrera
Date:
Subject: Re: in query variables....