Unix Technical Forum

Re: PLs and domain constraints

This is a discussion on Re: PLs and domain constraints within the pgsql Hackers forums, part of the PostgreSQL category; --> Neil Conway <neilc@samurai.com> writes: > For #2, I'm not sure where the right place to check domain constraints > ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 08:27 AM
Tom Lane
 
Posts: n/a
Default Re: PLs and domain constraints

Neil Conway <neilc@samurai.com> writes:
> For #2, I'm not sure where the right place to check domain constraints
> is. I was thinking about adding the check to the fmgr function call
> logic[1], but the domain checking code needs an ExprContext in which to
> evaluate the constraint, which wouldn't easily be accessible.


I'd go with making the PLs do it. fmgr is a very low logical level and
it's inappropriate for it to even know what a domain is. As an example
of the problems you will run into: how is fmgr going to find out whether
the target type is a domain, much less what its constraints are? It
can't assume that it's running inside a transaction, or even that the
system catalog access machinery is alive yet.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 08:37 AM
Thomas Hallgren
 
Posts: n/a
Default Re: PLs and domain constraints

Tom Lane wrote:
> Neil Conway <neilc@samurai.com> writes:
>> For #2, I'm not sure where the right place to check domain constraints
>> is. I was thinking about adding the check to the fmgr function call
>> logic[1], but the domain checking code needs an ExprContext in which to
>> evaluate the constraint, which wouldn't easily be accessible.

>
> I'd go with making the PLs do it. fmgr is a very low logical level and
> it's inappropriate for it to even know what a domain is. As an example
> of the problems you will run into: how is fmgr going to find out whether
> the target type is a domain, much less what its constraints are? It
> can't assume that it's running inside a transaction, or even that the
> system catalog access machinery is alive yet.
>

Should I consider this as something to add to the PL/Java TODO list? Or is there more to be
discussed?

Regards,
Thomas Hallgren


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 08:37 AM
Tom Lane
 
Posts: n/a
Default Re: PLs and domain constraints

Thomas Hallgren <thomas@tada.se> writes:
>> Neil Conway <neilc@samurai.com> writes:
>>> For #2, I'm not sure where the right place to check domain constraints
>>> is.


> Should I consider this as something to add to the PL/Java TODO list?


Yup, probably.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 08:37 AM
Neil Conway
 
Posts: n/a
Default Re: PLs and domain constraints

On Mon, 2006-01-09 at 20:23 +0100, Thomas Hallgren wrote:
> Should I consider this as something to add to the PL/Java TODO list?


Probably, yes (if/when I fix the in-tree PLs I was planning to take a
look at all the externally-maintained ones, although you're welcome to
do it instead).

Before domain constraints can be efficiently checked in PLs, the backend
needs some additional infrastructure (see recent discussion of typcache
changes on pgsql-patches, subject: "plpgsql: check domain constraints").
When that's finished, checking constraints in a PL should be fairly
easy.

-Neil



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com