Re: cursor question

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: cursor question
Date: 2009-02-25 16:18:26
Message-ID: 162867790902250818h1b75336exb939e3e3bf593593@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

when you would to change name of table - you have to use dynamic query

38.7.2.2. OPEN FOR EXECUTE

OPEN unbound_cursor [ [ NO ] SCROLL ] FOR EXECUTE query_string;

http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html

regards
Pavel Stehule

2009/2/25 Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> short question. Why is this not possible:
>
> CREATE OR REPLACE FUNCTION user_cursor_open(text) RETURNS refcursor AS $$
> DECLARE
>        curs1 CURSOR FOR SELECT * FROM $1;
> BEGIN
>        OPEN curs1;
>        RETURN curs1;
> END; $$ LANGUAGE plpgsql;
>
> Or, how do I set a parameter when using cursor?
>
> Thanks in advance
>
> - --
> St.Pauli - Hamburg - Germany
>
> Andreas Wenk
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFJpWlyVa7znmSP9AwRAv2MAJ9jHICtLeIEv+QVzeqBWSkheXDmpgCgwMUH
> t0/HWRPsx56jGhSVUQXyb9I=
> =XMXi
> -----END PGP SIGNATURE-----
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-02-25 16:26:33 Re: Using xmin to identify last modified rows
Previous Message Joshua D. Drake 2009-02-25 15:54:16 Re: Warm standby failover mechanism