Re: proposal: function parse_ident - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal: function parse_ident
Date
Msg-id CAFj8pRAWQtnbudFqMdi6GN8-w8oP0UYQB+GMQmBtdBdprHBQ=Q@mail.gmail.com
Whole thread Raw
In response to Re: proposal: function parse_ident  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: proposal: function parse_ident  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers


2015-09-08 14:06 GMT+02:00 Robert Haas <robertmhaas@gmail.com>:
On Fri, Sep 4, 2015 at 12:24 AM, Pavel Stehule <pavel.stehule@gmail.com> 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 without external hint, you cannot to decide if identifier
> is schema.table or table.column. But the rules for parsing is exactly same.
>
> The function can be redesigned little bit:
>
> FUNCTION parse_ident(OUT level1 text,OUT level2 text,OUT level3 text,OUT
> specific text)
>
> so it can parse function myschema.myfunc(xx int)
>
> level1: NULL
> level2: myschema
> level3: myfunc
> specific: (xx int)
>
> Is it acceptable?

Well, *I* think that would be useful.  I'm not sure it belongs in
core, but useful?  Yeah, definitely.  I would probably make it text[]
rather than level1, level2, level3, though.

Returning a array is a good idea.

Pavel
 

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-hackers by date:

Previous
From: Rajeev rastogi
Date:
Subject: Memory Context Info dump
Next
From: Michael Paquier
Date:
Subject: Re: New functions