Skip site navigation (1) Skip section navigation (2)

Re: domain constraints and UNKNOWN params

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>, david(at)justatheory(dot)com
Subject: Re: domain constraints and UNKNOWN params
Date: 2006-01-12 04:31:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Neil Conway <neilc(at)samurai(dot)com> writes:
> I've also attached a patch that should fix the issue -- coerce_type()
> neglected to apply coerce_to_domain() to the type inferred for an
> UNKNOWN Param.

This is a good catch, but the patch's added check on targetTyptype is a
waste of code and cycles.  coerce_to_domain is perfectly capable of
doing nothing when nothing is called for.  (The reason the other paths
in the routine make such checks is that they can do so more or less for
free, thereby saving one catalog lookup in coerce_to_domain.  If it's
going to cost a catalog lookup anyway to find out if the type is a
domain, you might as well let coerce_to_domain do it.)

IOW, all you need to add is a coerce_to_domain call.  Compare a somewhat
related recent patch here:

> Barring any objections, I intend to apply the patch to
> HEAD and release branches as far back as the problem exists (likely 8.0
> and 8.1, and possibly 7.4 -- I haven't checked yet).

I think it's probably in 7.4 too.

I wonder whether there is any reasonably simple way to audit the whole
backend for missing domain processing...

			regards, tom lane

In response to


pgsql-patches by date

Next:From: ITAGAKI TakahiroDate: 2006-01-12 05:22:41
Subject: Re: Free WAL caches on switching segments
Previous:From: Neil ConwayDate: 2006-01-12 00:30:01
Subject: domain constraints and UNKNOWN params

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group