pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Perry <rlperry@lodestonetechnologies.com>
Cc: pgsql-interfaces@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: By Passed Domain Constraints
Date: Wed, 06 Jul 2005 12:05:58 -0400
Message-ID: <27039.1120665958@sss.pgh.pa.us> (raw)
In-Reply-To: <B37006A8-8E96-4E45-B01F-11BA87DF383F@lodestonetechnologies.com>
References: <61C4410A-F2CE-49E9-92BA-1BDF89818DAA@lodestonetechnologies.com>
	<26103.1120660537@sss.pgh.pa.us>
	<B37006A8-8E96-4E45-B01F-11BA87DF383F@lodestonetechnologies.com>

Robert Perry <rlperry@lodestonetechnologies.com> writes:
>      I have also been bitten by the problem you are describing. But,  
> that one is a problem even when called from psql if I am not  
> mistaken.  Does psql not use pqlib?  Perhaps it is something about  
> PQexecParams that is the problem.  I will test in a little while.

[ thinks about it... ]  If you've declared the function input parameter
as a domain type and then write a parameterized query like
	... function($1) ...
and don't specify any particular datatype for the parameter symbol,
I think the backend will infer the domain type as the parameter type.
Which would also allow bypassing the domain checks.

You could work around this by explicitly specifying the parameter
type as text or varchar or whatever the domain's base type is.
I wonder though if we oughtn't change the backend so that the inferred
type of a parameter symbol is never a domain, but the domain's base
type.  That would force the proper application of CoerceToDomain inside
the constructed query parsetree.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <27039.1120665958@sss.pgh.pa.us>
Permalink:  ../27039.1120665958@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27039.1120665958@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rlperry@lodestonetechnologies.com, pgsql-hackers@postgresql.org
  Subject: Re: By Passed Domain Constraints
  In-Reply-To: <27039.1120665958@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox