Re: Dry run through input function for a given built-in data type - Mailing list pgsql-general

From David G. Johnston
Subject Re: Dry run through input function for a given built-in data type
Date
Msg-id CAKFQuwZU52Hqy9F5df=n+MVAwsV3qCvFH6iHz2BTw4z-GXjaMg@mail.gmail.com
Whole thread Raw
In response to Dry run through input function for a given built-in data type  (Fabio Ugo Venchiarutti <fabio@vuole.me>)
List pgsql-general
On Tue, May 12, 2015 at 11:23 PM, Fabio Ugo Venchiarutti <fabio@vuole.me> wrote:
Is there any cleaner way to, say, only run the validation part of a type input function
​ [...]​

​This pre-supposes that said type input function has a distinct validation phase as opposed to simply performing its parse and failing when it encounters something it cannot handle.

​I would suggest you attempt to separate the non-context-aware stuff and the context-aware stuff into two separate phases; and only data that passes the non-context-aware tests would then be bundled up into the full CTE where you then check constraints and the like.​  The how is beyond me but this is an open source project so you have access to all of the relevant functions.  How you would go about using them without having to invoke the engine I do not know but that seems like the only performant option since the PostgreSQL executor isn't designed to handle your usage pattern.

Without considerably more understanding of the how suggestions are difficult to make - even were I to know the innards of PostgreSQL and using C.  Others more knowledgeable will likely chime in but I suspect that I'm pretty close to the mark on this one.

Yes, you could make a regexp-base validation library...but that screams "maintenance nightmare" to me.  I'm doubtful such a thing already exists.

David J.

pgsql-general by date:

Previous
From: Fabio Ugo Venchiarutti
Date:
Subject: Dry run through input function for a given built-in data type
Next
From: Ravi Krishna
Date:
Subject: How to clear buffer