Re: [HACKERS] proposal: function parse_ident

2016-03-20 Thread Pavel Stehule
2016-03-18 16:26 GMT+01:00 Teodor Sigaev : > I hope so the messages are ok now. Few more regress tests added. >> > > Thank you, committed. Thank you very much Pavel > > > -- > Teodor Sigaev E-mail: teo...@sigaev.ru >

Re: [HACKERS] proposal: function parse_ident

2016-03-18 Thread Pavel Stehule
Hi 2016-03-14 17:39 GMT+01:00 Teodor Sigaev : > 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

Re: [HACKERS] proposal: function parse_ident

2016-03-18 Thread Teodor Sigaev
I hope so the messages are ok now. Few more regress tests added. Thank you, committed. -- Teodor Sigaev E-mail: teo...@sigaev.ru WWW: http://www.sigaev.ru/ -- Sent via pgsql-hackers mailing list

Re: [HACKERS] proposal: function parse_ident

2016-03-15 Thread Pavel Stehule
2016-03-14 17:39 GMT+01:00 Teodor Sigaev : > 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

Re: [HACKERS] proposal: function parse_ident

2016-03-14 Thread Teodor Sigaev
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,

Re: [HACKERS] proposal: function parse_ident

2016-03-10 Thread Pavel Stehule
2016-03-10 15:34 GMT+01:00 Teodor Sigaev : > select >> >> parse_ident(E'X\rXX'); >> >> >> I am sending updated patch - I used json function for correct escaping - >> the >> escaping behave is same. >> > > Hmm, it doesn't

Re: [HACKERS] proposal: function parse_ident

2016-03-10 Thread Teodor Sigaev
select parse_ident(E'X\rXX'); 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

Re: [HACKERS] proposal: function parse_ident

2016-02-19 Thread Pavel Stehule
Hi 2016-02-18 4:59 GMT+01:00 Pavel Stehule : > select >> parse_ident(E'X\rXX'); > > I am sending updated patch - I used json function for correct escaping - the escaping behave is same. Regards Pavel diff --git

Re: [HACKERS] proposal: function parse_ident

2016-02-17 Thread Pavel Stehule
Hi 2016-02-17 14:02 GMT+01:00 Teodor Sigaev : > I missed some of my edits. Updated patch with those in place attached. >> > > I'm sorry, but special chararacter still isn't escaped correctly in error > messages: > > % select >

Re: [HACKERS] proposal: function parse_ident

2016-02-17 Thread Teodor Sigaev
I missed some of my edits. Updated patch with those in place attached. I'm sorry, but special chararacter still isn't escaped correctly in error messages: % select parse_ident(E'X\rXX'); XX""X

Re: [HACKERS] proposal: function parse_ident

2016-02-16 Thread Pavel Stehule
2016-02-17 1:38 GMT+01:00 Jim Nasby : > On 2/11/16 1:27 AM, Pavel Stehule wrote: > >> I editorialized the docs and some of the comments. In particular, I >> documented behavior of not truncating, and recommended casting to >> name[] if user cares about that.

Re: [HACKERS] proposal: function parse_ident

2016-02-16 Thread Jim Nasby
On 2/11/16 1:27 AM, Pavel Stehule wrote: I editorialized the docs and some of the comments. In particular, I documented behavior of not truncating, and recommended casting to name[] if user cares about that. Added a unit test to verify that works. BTW, I saw mention in the thread

Re: [HACKERS] proposal: function parse_ident

2016-02-13 Thread Pavel Stehule
Hi Jim 2016-02-11 8:27 GMT+01:00 Pavel Stehule > > > ok > >> >> Also added test for invalid characters. >> >> I think "strict" would be more in line with other uses in code. There are >> currently no other occurrences of 'strictmode' in the code. There are loads >> of

Re: [HACKERS] proposal: function parse_ident

2016-02-10 Thread Jim Nasby
On 2/10/16 12:26 PM, Jim Nasby wrote: I editorialized the docs and some of the comments. In particular, I documented behavior of not truncating, and recommended casting to name[] if user cares about that. Added a unit test to verify that works. BTW, I saw mention in the thread about not

Re: [HACKERS] proposal: function parse_ident

2016-02-10 Thread Jim Nasby
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: not tested Documentation:not tested NEEDS CATVERSION BUMP I editorialized the docs and some of the

Re: [HACKERS] proposal: function parse_ident

2016-02-10 Thread Pavel Stehule
2016-02-10 19:26 GMT+01:00 Jim Nasby : > The following review has been posted through the commitfest application: > make installcheck-world: tested, passed > Implements feature: tested, passed > Spec compliant: not tested > Documentation:not

Re: [HACKERS] proposal: function parse_ident

2016-02-09 Thread Pavel Stehule
Hi 2016-02-08 16:55 GMT+01:00 Teodor Sigaev : > rebased, messages changes per Tom's proposal >> > Cool feature and sometimes I needed it a lot. > > But, seems, there are some bugs in error processing. > > 1 > Following query is okay: > # select * from parse_ident(E'"Some \r

Re: [HACKERS] proposal: function parse_ident

2016-02-09 Thread Pavel Stehule
Hi sorry, I am sending missing attachment Regards Pavel diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml new file mode 100644 index f9eea76..bfba459 *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml *** *** 1821,1826 --- 1821,1843

Re: [HACKERS] proposal: function parse_ident

2016-02-08 Thread Pavel Stehule
2016-02-08 16:55 GMT+01:00 Teodor Sigaev : > rebased, messages changes per Tom's proposal >> > Cool feature and sometimes I needed it a lot. > > But, seems, there are some bugs in error processing. > I am looking on it Regards Pavel

Re: [HACKERS] proposal: function parse_ident

2016-02-08 Thread Teodor Sigaev
rebased, messages changes per Tom's proposal Cool feature and sometimes I needed it a lot. But, seems, there are some bugs in error processing. 1 Following query is okay: # select * from parse_ident(E'"Some \r Schema".someTable'); parse_ident -- {"Some \r

Re: [HACKERS] proposal: function parse_ident

2016-02-08 Thread Alvaro Herrera
Pavel Stehule wrote: > I am looking on it Thanks, closing as returned-with-feedback. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To

Re: [HACKERS] proposal: function parse_ident

2016-01-24 Thread Pavel Stehule
Hi 2016-01-23 16:36 GMT+01:00 Tom Lane : > Michael Paquier writes: > > On Sat, Jan 23, 2016 at 1:25 AM, Marko Tiikkaja wrote: > > + errmsg("identifier contains disallowed chars"), > > +

Re: [HACKERS] proposal: function parse_ident

2016-01-23 Thread Tom Lane
Michael Paquier writes: > On Sat, Jan 23, 2016 at 1:25 AM, Marko Tiikkaja wrote: > + errmsg("identifier contains disallowed chars"), > + errdetail("string \"%s\" is not valid identifier", > +

Re: [HACKERS] proposal: function parse_ident

2016-01-23 Thread Michael Paquier
On Sat, Jan 23, 2016 at 1:25 AM, Marko Tiikkaja wrote: > Hi Pavel, > > Sorry for the lack of review here. I didn't realize I was still the > reviewer for this after it had been moved to another commitfest. > > That said, I think I've exhausted my usefulness here as a reviewer.

Re: [HACKERS] proposal: function parse_ident

2016-01-22 Thread Marko Tiikkaja
Hi Pavel, Sorry for the lack of review here. I didn't realize I was still the reviewer for this after it had been moved to another commitfest. That said, I think I've exhausted my usefulness here as a reviewer. Marking ready for committer. .m -- Sent via pgsql-hackers mailing list

Re: [HACKERS] proposal: function parse_ident

2015-12-23 Thread Michael Paquier
On Thu, Dec 3, 2015 at 5:31 AM, Pavel Stehule wrote: > There is: SplitIdentifierString or textToQualifiedNameList in varlena.c. My > first patch was based on these functions. But I cannot to use it. > > 1. major reason: The buildin parser is based on searching the dot "."

Re: [HACKERS] proposal: function parse_ident

2015-12-02 Thread Pavel Stehule
Hi 2015-11-17 1:49 GMT+01:00 Marko Tiikkaja : > On 9/11/15 12:25 PM, Pavel Stehule wrote: > >> new update of parse_ident function patch >> > > Nice! I've certainly wanted something like this a number of times. > > Some comments about the v2 of the patch: > >- The patch doesn't

Re: [HACKERS] proposal: function parse_ident

2015-12-02 Thread Jim Nasby
On 9/15/15 11:49 PM, Pavel Stehule wrote: 1. processing user input with little bit more comfort - the user doesn't need to separate schema and table This is especially useful if you're doing anything that needs to dynamically work with different objects. I'd say about 80% of the time I'm

Re: [HACKERS] proposal: function parse_ident

2015-11-16 Thread Marko Tiikkaja
On 9/11/15 12:25 PM, Pavel Stehule wrote: new update of parse_ident function patch Nice! I've certainly wanted something like this a number of times. Some comments about the v2 of the patch: - The patch doesn't apply anymore, so it should be rebased. - The docs don't even try and

Re: [HACKERS] proposal: function parse_ident

2015-09-15 Thread Pavel Stehule
2015-09-16 2:41 GMT+02:00 Peter Eisentraut : > On 9/11/15 6:25 AM, Pavel Stehule wrote: > > new update of parse_ident function patch > > How would you actually use this? > > I know several people have spoken up that they could use this, but could > you provide a few actual

Re: [HACKERS] proposal: function parse_ident

2015-09-15 Thread Peter Eisentraut
On 9/11/15 6:25 AM, Pavel Stehule wrote: > new update of parse_ident function patch How would you actually use this? I know several people have spoken up that they could use this, but could you provide a few actual practical examples? -- Sent via pgsql-hackers mailing list

Re: [HACKERS] proposal: function parse_ident

2015-09-11 Thread Pavel Stehule
Hi new update of parse_ident function patch Regards Pavel diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml new file mode 100644 index 22d4f61..1581d5a *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml *** *** 1707,1712 --- 1707,1727

Re: [HACKERS] proposal: function parse_ident

2015-09-09 Thread Pavel Stehule
next iteration - fixed bug in parsing UTF8 chars, enhanced error messages. Regards Pavel diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml new file mode 100644 index b3b78d2..75ea33a *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml *** *** 1707,1712 ---

Re: [HACKERS] proposal: function parse_ident

2015-09-09 Thread Pavel Stehule
Hi 2015-09-09 21:55 GMT+02:00 Alvaro Herrera : > Pavel Stehule wrote: > > > I cannot to use current SplitIdentifierString because it is designed for > > different purpose - and it cannot to separate non identifier part. But > the > > code is simple - and will be

Re: [HACKERS] proposal: function parse_ident

2015-09-09 Thread Alvaro Herrera
Pavel Stehule wrote: > I cannot to use current SplitIdentifierString because it is designed for > different purpose - and it cannot to separate non identifier part. But the > code is simple - and will be cleaned. > > postgres=# select * from parse_ident('"AHOJ".NAZDAR[]'::text); >

Re: [HACKERS] proposal: function parse_ident

2015-09-08 Thread Robert Haas
On Fri, Sep 4, 2015 at 12:24 AM, Pavel Stehule wrote: > The alghoritm for parsing identifiers is same - the differences are in a > names of levels, and in ending symbols. > > I don't would to write totally generic parser - more without access to > system catalog or

Re: [HACKERS] proposal: function parse_ident

2015-09-08 Thread Pavel Stehule
2015-09-08 20:17 GMT+02:00 Corey Huinker : > > > I would have immediate use for this. So often a function is written with a > table name as a parameter and it's not immediately clear if the schema is > to be parsed out of the string, prescribed, or a separate

Re: [HACKERS] proposal: function parse_ident

2015-09-08 Thread Pavel Stehule
Hi I sending the path with little bit enhanced parser - it doesn't support utf8 alpha in identifiers yet Regards Pavel diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml new file mode 100644 index b3b78d2..75ea33a *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml

Re: [HACKERS] proposal: function parse_ident

2015-09-08 Thread Pavel Stehule
2015-09-08 14:06 GMT+02:00 Robert Haas : > On Fri, Sep 4, 2015 at 12:24 AM, Pavel Stehule > wrote: > > The alghoritm for parsing identifiers is same - the differences are in a > > names of levels, and in ending symbols. > > > > I don't would to

Re: [HACKERS] proposal: function parse_ident

2015-09-08 Thread Corey Huinker
On Tue, Sep 8, 2015 at 8:57 AM, Pavel Stehule wrote: > > > 2015-09-08 14:06 GMT+02:00 Robert Haas : > >> On Fri, Sep 4, 2015 at 12:24 AM, Pavel Stehule >> wrote: >> > The alghoritm for parsing identifiers is same - the

Re: [HACKERS] proposal: function parse_ident

2015-09-03 Thread Andres Freund
On 2015-08-23 17:46:36 +0200, Pavel Stehule wrote: > here is the patch > > It is really trivial - all heavy work was done done before. This seems to entirely disregard the comments in http://archives.postgresql.org/message-id/29030.1440030152%40sss.pgh.pa.us about the fact that this approach

Re: [HACKERS] proposal: function parse_ident

2015-09-03 Thread Pavel Stehule
2015-09-03 13:11 GMT+02:00 Andres Freund : > On 2015-08-23 17:46:36 +0200, Pavel Stehule wrote: > > here is the patch > > > > It is really trivial - all heavy work was done done before. > > This seems to entirely disregard the comments in >

Re: [HACKERS] proposal: function parse_ident

2015-08-23 Thread Pavel Stehule
Hi 2015-08-21 7:15 GMT+02:00 Pavel Stehule pavel.steh...@gmail.com: 2015-08-20 21:16 GMT+02:00 Jim Nasby jim.na...@bluetreble.com: On 8/19/15 7:22 PM, Tom Lane wrote: Jim Nasby jim.na...@bluetreble.com writes: Don't say parse names for things other than tables. Only a minority of the

Re: [HACKERS] proposal: function parse_ident

2015-08-20 Thread Pavel Stehule
2015-08-20 2:22 GMT+02:00 Tom Lane t...@sss.pgh.pa.us: Jim Nasby jim.na...@bluetreble.com writes: Don't say parse names for things other than tables. Only a minority of the types of objects used in the database have names that meet this specification. Really? My impression is that

Re: [HACKERS] proposal: function parse_ident

2015-08-20 Thread Pavel Stehule
2015-08-20 21:16 GMT+02:00 Jim Nasby jim.na...@bluetreble.com: On 8/19/15 7:22 PM, Tom Lane wrote: Jim Nasby jim.na...@bluetreble.com writes: Don't say parse names for things other than tables. Only a minority of the types of objects used in the database have names that meet this

Re: [HACKERS] proposal: function parse_ident

2015-08-20 Thread Jim Nasby
On 8/19/15 7:22 PM, Tom Lane wrote: Jim Nasby jim.na...@bluetreble.com writes: Don't say parse names for things other than tables. Only a minority of the types of objects used in the database have names that meet this specification. Really? My impression is that almost everything that's not

Re: [HACKERS] proposal: function parse_ident

2015-08-19 Thread Pavel Stehule
Hi 2015-08-19 21:33 GMT+02:00 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: I miss a functionality that helps with parsing any identifier to basic three parts - database, schema, objectname. We have this function internally, but it is not available for SQL

Re: [HACKERS] proposal: function parse_ident

2015-08-19 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: I miss a functionality that helps with parsing any identifier to basic three parts - database, schema, objectname. We have this function internally, but it is not available for SQL layer. FUNCTION parse_ident(IN ident text, OUT dbname text, OUT

Re: [HACKERS] proposal: function parse_ident

2015-08-19 Thread Jim Nasby
On 8/19/15 2:44 PM, Pavel Stehule wrote: Don't say parse names for things other than tables. Only a minority of the types of objects used in the database have names that meet this specification. Really? My impression is that almost everything that's not a shared object allows for

Re: [HACKERS] proposal: function parse_ident

2015-08-19 Thread Tom Lane
Jim Nasby jim.na...@bluetreble.com writes: Don't say parse names for things other than tables. Only a minority of the types of objects used in the database have names that meet this specification. Really? My impression is that almost everything that's not a shared object allows for a

[HACKERS] proposal: function parse_ident

2015-08-18 Thread Pavel Stehule
Hi I miss a functionality that helps with parsing any identifier to basic three parts - database, schema, objectname. We have this function internally, but it is not available for SQL layer. FUNCTION parse_ident(IN ident text, OUT dbname text, OUT schemaname text, OUT objectname text) Examples: