In CVS tip:

regression=# create domain nnint int not null;
CREATE DOMAIN
regression=# create table foo (f1 nnint);
CREATE TABLE
regression=# insert into foo values(null);
ERROR:  Domain nnint does not allow NULL values		-- okay
regression=# \copy foo from stdin
123
\N
\.
regression=# select * from foo;
 f1
-----
 123
							-- not okay
(2 rows)

regression=# create domain vc4 varchar(4);
CREATE DOMAIN
regression=# create table foot (f1 vc4);
CREATE TABLE
regression=# \copy foot from stdin
1234567890
\.
regression=# select * from foot;
     f1
------------
 1234567890						-- not okay
(1 row)


			regards, tom lane

Mon, 16 Sep 2002 17:54:00 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Bug: COPY IN doesn't test domain constraints
On Mon, 2002-09-16 at 17:54, Tom Lane wrote:
> In CVS tip:
> 
> regression=# create domain nnint int not null;
> CREATE DOMAIN

Ok, I'll take a look at this today.

Thanks


-- 
  Rod Taylor


17 Sep 2002 08:24:03 -0400
Rod Taylor <rbt@rbt.ca>
Re: Bug: COPY IN doesn't test domain constraints
Fixed this problem and added regression tests in domain.sql.

Also:
- Changed header file order (alphabetical)
- Changed to m = attnum - 1 in binary copy code for consistency

On Mon, 2002-09-16 at 17:54, Tom Lane wrote:
> In CVS tip:
> 
> regression=# create domain nnint int not null;
> CREATE DOMAIN
> regression=# create table foo (f1 nnint);
> CREATE TABLE
> regression=# insert into foo values(null);
> ERROR:  Domain nnint does not allow NULL values		-- okay
> regression=# \copy foo from stdin
> 123
> \N
> \.
> regression=# select * from foo;
>  f1
> -----
>  123
> 							-- not okay
> (2 rows)
> 
> regression=# create domain vc4 varchar(4);
> CREATE DOMAIN
> regression=# create table foot (f1 vc4);
> CREATE TABLE
> regression=# \copy foot from stdin
> 1234567890
> \.
> regression=# select * from foot;
>      f1
> ------------
>  1234567890						-- not okay
> (1 row)
> 
> 
> 			regards, tom lane
> 
-- 
  Rod Taylor
17 Sep 2002 11:19:32 -0400
Rod Taylor <rbt@rbt.ca>
Re: Bug: COPY IN doesn't test domain constraints

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Rod Taylor wrote:
> Fixed this problem and added regression tests in domain.sql.
> 
> Also:
> - Changed header file order (alphabetical)
> - Changed to m = attnum - 1 in binary copy code for consistency
> 
> On Mon, 2002-09-16 at 17:54, Tom Lane wrote:
> > In CVS tip:
> > 
> > regression=# create domain nnint int not null;
> > CREATE DOMAIN
> > regression=# create table foo (f1 nnint);
> > CREATE TABLE
> > regression=# insert into foo values(null);
> > ERROR:  Domain nnint does not allow NULL values		-- okay
> > regression=# \copy foo from stdin
> > 123
> > \N
> > \.
> > regression=# select * from foo;
> >  f1
> > -----
> >  123
> > 							-- not okay
> > (2 rows)
> > 
> > regression=# create domain vc4 varchar(4);
> > CREATE DOMAIN
> > regression=# create table foot (f1 vc4);
> > CREATE TABLE
> > regression=# \copy foot from stdin
> > 1234567890
> > \.
> > regression=# select * from foot;
> >      f1
> > ------------
> >  1234567890						-- not okay
> > (1 row)
> > 
> > 
> > 			regards, tom lane
> > 
> -- 
>   Rod Taylor

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Wed, 18 Sep 2002 00:57:23 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Bug: COPY IN doesn't test domain constraints

Patch applied.  Thanks.

---------------------------------------------------------------------------


Rod Taylor wrote:
> Fixed this problem and added regression tests in domain.sql.
> 
> Also:
> - Changed header file order (alphabetical)
> - Changed to m = attnum - 1 in binary copy code for consistency
> 
> On Mon, 2002-09-16 at 17:54, Tom Lane wrote:
> > In CVS tip:
> > 
> > regression=# create domain nnint int not null;
> > CREATE DOMAIN
> > regression=# create table foo (f1 nnint);
> > CREATE TABLE
> > regression=# insert into foo values(null);
> > ERROR:  Domain nnint does not allow NULL values		-- okay
> > regression=# \copy foo from stdin
> > 123
> > \N
> > \.
> > regression=# select * from foo;
> >  f1
> > -----
> >  123
> > 							-- not okay
> > (2 rows)
> > 
> > regression=# create domain vc4 varchar(4);
> > CREATE DOMAIN
> > regression=# create table foot (f1 vc4);
> > CREATE TABLE
> > regression=# \copy foot from stdin
> > 1234567890
> > \.
> > regression=# select * from foot;
> >      f1
> > ------------
> >  1234567890						-- not okay
> > (1 row)
> > 
> > 
> > 			regards, tom lane
> > 
> -- 
>   Rod Taylor

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Thu, 19 Sep 2002 23:48:07 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Bug: COPY IN doesn't test domain constraints