Re: Duplication des données insérées dans un fichier

From: Sébastien Dinot <sebastien(dot)dinot(at)free(dot)fr>
To: pgsql-fr-generale(at)postgresql(dot)org
Subject: Re: Duplication des données insérées dans un fichier
Date: 2008-11-11 11:51:04
Message-ID: 20081111115104.GA5356@dinot.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-fr-generale

Bonjour,

Marc Cousin a écrit :
> Pour s'en sortir avec le copy, il faut le mettre dans un execute
> (testé à l'instant sur une 8.3) ...

Merci beaucoup, ton code fonctionne parfaitement.

Comme la subtilité m'échappait, j'ai jeté un oeil à la documentation de
PostgreSQL et je comprends mieux maintenant l'utilité du EXECUTE :

------------------------------------------------------------------------
Oftentimes you will want to generate dynamic commands inside your
PL/pgSQL functions, that is, commands that will involve different tables
or different data types each time they are executed. PL/pgSQL's normal
attempts to cache plans for commands (as discussed in Section 38.10.2)
will not work in such scenarios. To handle this sort of problem, the
EXECUTE statement is provided:

EXECUTE command-string [ INTO [STRICT] target ];

where command-string is an expression yielding a string (of type text)
containing the command to be executed and target is a record variable,
row variable, or a comma-separated list of simple variables and
record/row fields.
------------------------------------------------------------------------

Sébastien

--
Sébastien Dinot, sebastien(dot)dinot(at)free(dot)fr
http://sebastien.dinot.free.fr/
Ne goûtez pas au logiciel libre, vous ne pourriez plus vous en passer !

In response to

Browse pgsql-fr-generale by date

  From Date Subject
Next Message Sébastien Dinot 2008-11-11 12:25:57 Re: Duplication des données insérées dans un fichier
Previous Message Marc Cousin 2008-11-11 10:45:41 Re: Duplication des données insérées dans un fichier