Binary input functions fail to enforce typmod

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Binary input functions fail to enforce typmod
Date: 2005-07-10 18:32:01
Message-ID: 1645.1121020321@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Whilst working on the change I proposed to make domain types enforce
their constraints inside the typinput/typreceive routines, I realized
that there's a fairly serious flaw in the design of typreceive routines:
we don't pass them a typmod so they cannot enforce type-specific typmod
restrictions. This means for example that COPY FROM BINARY could insert
a more-than-four-character string into a char(4) column.

The correct solution of course is to include a typmod value in the
arguments passed to typreceive routines, and to adjust the receive
routines of those datatypes that use typmod to enforce the same
restrictions as the corresponding typinput routines do.

I think this is a "must fix" for 8.1.

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-07-10 18:33:06 Re: latest pgcrypto patches cause compile errors
Previous Message Sivaraman K.G 2005-07-10 18:28:27 Re: [BUGS] BUG #1745: Unable to delete data from the database