Neil Conway <neilc@samurai.com> writes:
> In any case, if we use the query string as supplied by the user, how do
> we produce that string in the case of SQL PREPARE? Manually stripping a
> "PREPARE ... AS" prefix from the query string is difficult to do
> robustly, but it seems (a) expensive (b) inconsistent to deparse the
> Query for SQL PREPARE but not for Parse messages. We could just include
> the "PREPARE ... AS" prefix for SQL PREPAREs, but that seems ugly.
I don't see the problem. Defining the view field as "the string sent to
the server to create the prepared statement" seems perfectly consistent
to me.
In practice, any given application will probably use one method to the
exclusion of the other, and wouldn't notice the "inconsistency" anyway.
If you are using both methods of preparing statements for some reason,
it's not improbable that you would want to know which way a given
statement was created, and seeing the PREPARE in there would be a useful
cue.
regards, tom lane