Re: proposal: function parse_ident

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: function parse_ident
Date: 2016-03-10 19:47:49
Message-ID: CAFj8pRDz9v+wuVbd2QJ8jn_oQUiS-OVKytXX9wJya2J+BtY_QQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-03-10 15:34 GMT+01:00 Teodor Sigaev <teodor(at)sigaev(dot)ru>:

> select
>>
>> parse_ident(E'X\rXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
>>
>>
>> I am sending updated patch - I used json function for correct escaping -
>> the
>> escaping behave is same.
>>
>
> Hmm, it doesn't look so:
> % select parse_ident(E'_\005');
> ERROR: identifier contains disallowed characters: "_\u0005"
> % select parse_ident(E'\005');
> ERROR: missing identifier: "\u0005"
>
> but
>
> # select parse_ident(E'"\005"');
> parse_ident
> -------------
> {\x05}
>
> Error messages above point wrong character wrongly.
>
> One more inconsistence:
> # select parse_ident(E'"\005"') as "\005";
> \005
> --------
> {\x05}
>
> Display outputs of actual identifier and parse_indent are differ.
>
> Actually, I can live with both but are any other opinions? Seems, at least
> difference of actual identifier and output of parse_indent should be
> pointed in docs.

I afraid so I cannot to fix this inconsistency (if this is inconsistency -
the binary values are same) - the parameter of function is raw string with
processed escape codes, and I have not any information about original
escape sequences. When you enter octet value, and I show it as hex value,
then there should be difference. Buy I have not information about your
input (octet or hex). I have the original string of SQL identifier inside
parser, executor, but I have not original string of function parameter
inside function (not without pretty complex and long code).

I am trying describe it in doc (I am sorry for my less level English) in
new patch. Fixed duplicated oid too.

Regards

Pavel

>
> --
> Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
> WWW:
> http://www.sigaev.ru/
>

Attachment Content-Type Size
parse_ident-12.patch text/x-patch 16.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Igal @ Lucee.org 2016-03-10 19:48:19 Re: Add generate_series(date,date) and generate_series(date,date,integer)
Previous Message Robert Haas 2016-03-10 19:45:37 Re: WIP: Upper planner pathification