Binary input functions fail to enforce typmod - Mailing list pgsql-hackers

From Tom Lane
Subject Binary input functions fail to enforce typmod
Date
Msg-id 1645.1121020321@sss.pgh.pa.us
Whole thread Raw
List 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


pgsql-hackers by date:

Previous
From: Marko Kreen
Date:
Subject: Re: latest pgcrypto patches cause compile errors
Next
From: Bruce Momjian
Date:
Subject: Re: latest pgcrypto patches cause compile errors