From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: quoting psql varible as identifier |
Date: | 2010-01-04 12:56:41 |
Message-ID: | 162867791001040456w4ba9a0afg32f5a89c81942c70@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
I talked with Hitoshi Harada, and fmtId function is safe (minimally
for Japanese case). This function working without any errors, so we
must not duplicate a code.
Pavel
2010/1/4 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> hello
>
> 2010/1/2 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>>> here is patch
>>
>> I looked at this patch a bit, and I think the real problem with it is
>> that it's not multibyte safe. You've copied backend code that is
>> allowed to assume it's in a safe encoding (ie, one where multibyte
>> characters can't contain non-high-bit-set bytes). This is not okay
>> on the client side, see SJIS and similar encodings.
>>
>> Where you need to start out is by cloning PQescapeStringConn, which does
>> a similar type of transformation correctly even in unsafe encodings.
>> I think we'd agreed upthread that libpq should provide
>> PQescapeIdentifier functionality anyhow.
>>
>
> I am looking on psql directory. Now I found, so in this directory is
> linked dumputil.c - It could little bit to help us.
>
> I have one question. If I understand well, the function fmtId isn't
> multibyte safe? So why is possible to use it in pg_dump?
>
> Pavel
>
>> Once you've actually read that code, you'll realize that it's okay to
>> treat the error result as a warning, which resolves the other point
>> of concern. Just print the message and use the result anyway.
>>
>> regards, tom lane
>>
>
Attachment | Content-Type | Size |
---|---|---|
variable_escaping.diff | application/octet-stream | 5.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2010-01-04 13:29:52 | Re: pgsql: When estimating the selectivity of an inequality "column > |
Previous Message | Heikki Linnakangas | 2010-01-04 12:55:11 | Re: Backup history file should be replicated in Streaming Replication? |