Re: [GENERAL] regclass and format('%I')

2015-03-19 Thread Jason Dusek
On 15 March 2015 at 08:44, Tom Lane wrote: > "David G. Johnston" writes: > > ​IOW, as long as the output string matches: ^"(?:"{2})*"$ I do not see > how > > it is possible ​for format to lay in a value at %I that is any more > > insecure than the current behavior. If the input string already m

Re: [GENERAL] regclass and format('%I')

2015-03-15 Thread David G. Johnston
On Sunday, March 15, 2015, Tom Lane wrote: > "David G. Johnston" > writes: > > ​IOW, as long as the output string matches: ^"(?:"{2})*"$ I do not see > how > > it is possible ​for format to lay in a value at %I that is any more > > insecure than the current behavior. If the input string already

Re: [GENERAL] regclass and format('%I')

2015-03-15 Thread Tom Lane
"David G. Johnston" writes: > ​IOW, as long as the output string matches: ^"(?:"{2})*"$ I do not see how > it is possible ​for format to lay in a value at %I that is any more > insecure than the current behavior. If the input string already matches > that pattern then it could be output as-is

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread David G. Johnston
On Sat, Mar 14, 2015 at 8:29 AM, Tom Lane wrote: > Jason Dusek writes: > > It honestly seems far more reasonable to me that %s and %I should do > > the exact same thing with regclass. > > You're mistaken. The operation of format() is first to convert the > non-format arguments to text strings,

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Pavel Stehule
2015-03-15 3:09 GMT+01:00 Jason Dusek : > On 14 March 2015 at 09:17, David G. Johnston > wrote: > > On Saturday, March 14, 2015, Jason Dusek wrote: > >> It honestly seems far more reasonable to me that %s and %I should do > >> the exact same thing with regclass. My reasoning is as follows: > >>

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Jason Dusek
On 14 March 2015 at 09:17, David G. Johnston wrote: > On Saturday, March 14, 2015, Jason Dusek wrote: >> It honestly seems far more reasonable to me that %s and %I should do >> the exact same thing with regclass. My reasoning is as follows: >> >> ‘%I’ formats a something such that it is a valid i

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread David G. Johnston
On Saturday, March 14, 2015, Jason Dusek wrote: > It honestly seems far more reasonable to me that %s and %I should do > the exact same thing with regclass. My reasoning is as follows: > > ‘%I’ formats a something such that it is a valid identifier, > > regclass is already a valid identifier, > >

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Tom Lane
Jason Dusek writes: > It honestly seems far more reasonable to me that %s and %I should do > the exact same thing with regclass. You're mistaken. The operation of format() is first to convert the non-format arguments to text strings, using the output functions for their data types, and then to f

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Pavel Stehule
2015-03-14 10:09 GMT+01:00 Jason Dusek : > It honestly seems far more reasonable to me that %s and %I should do > the exact same thing with regclass. My reasoning is as follows: > > ‘%I’ formats a something such that it is a valid identifier, > > regclass is already a valid identifier, > > therefo

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Jason Dusek
It honestly seems far more reasonable to me that %s and %I should do the exact same thing with regclass. My reasoning is as follows: ‘%I’ formats a something such that it is a valid identifier, regclass is already a valid identifier, therefore, do nothing. Another line of reasoning: If you for

Re: [GENERAL] regclass and format('%I')

2015-03-13 Thread David G. Johnston
On Fri, Mar 13, 2015 at 12:18 PM, Jason Dusek wrote: > Hi All, > > The difference in how format handles `regclass` and `name` seems like an > inconsistency: > > WITH conversions(casts, format, result) AS ( > VALUES (ARRAY['name']::regtype[], '%I', format('%I', > name('select')

[GENERAL] regclass and format('%I')

2015-03-13 Thread Jason Dusek
Hi All, The difference in how format handles `regclass` and `name` seems like an inconsistency: WITH conversions(casts, format, result) AS ( VALUES (ARRAY['name']::regtype[], '%I', format('%I', name('select'))), (ARRAY['name']::regtype[], '%L', format('%