Search Postgresql Archives

Re: Array value syntax and escaping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Bex <Peter.Bex@xxxxxxxxx> writes:
> I am currently adding array value handling to the PostgreSQL interface
> for the Chicken Scheme compiler[*] and I was wondering if there's a more
> detailed documentation for the exact syntax of arrays than the short
> natural language explanation in the manual.

There is not, but you could always look at the source for array_out and
array_in if you want definitive answers ;-).  Personally what I'd do is
always double-quote each non-null array element; then the rules reduce
to "backslash any backslashes or double quotes".  If you're working in
a sane client encoding (not SJIS for instance) this is pretty trivial.

> IMHO, it would be a Good Thing to have helper procedures in libpq.

The problem with that is that the necessarily-arbitrary API would
probably add as much or more complexity as would be saved.  If C had
a simple and universally-followed convention for variable-size arrays,
it'd be easier to provide useful helpers ...

> I briefly considered "abusing" the PQescapeIdentifier procedure for
> escaping since the syntax for literals inside arrays seems to be exactly
> like that of SQL identifiers, but I'm not 100% sure about that and I
> also think the PQescapeIdentifier procedure shouldn't be overloaded for
> this purpose.

Well, that wouldn't work anyway, since backslashes aren't special in
identifiers.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux