From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: quoting psql varible as identifier |
Date: | 2010-01-18 18:31:43 |
Message-ID: | 603c8f071001181031m1fd03baeoeab08effbfc0fb40@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Jan 17, 2010 at 2:04 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> I rewrote patch so now interface for PQescapeIdentConn is same as
> PQescapeStringConn
>
> @3. I though so the protection under incomplete multibyte chars are
> enought - missing bytes are replaced by space - like
> PQescapeStringConn does.
That much is fine, but the output buffer is only guaranteed to be of
size 2n+1. Imagine the input is two double-quotes followed by a byte
for which pg_encoding_mblen() returns 4. The input is 3 characters
long so the user was responsible to provide 7 bytes of output space,
but you'll try to write 9 bytes to it (including the terminating NUL).
> But now - mechanism is exactly same, so this
> problem should be solved.
This is no better. What the function does no longer matches either
its comments or the documentation (which also contradict each other).
Let me take a crack at this and post a patch. We're making this
harder than it needs to be.
...Robert
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2010-01-18 18:52:38 | Re: quoting psql varible as identifier |
Previous Message | Magnus Hagander | 2010-01-18 17:44:28 | Re: mailing list archiver chewing patches |