From: | "Rod Taylor" <rbt(at)barchord(dot)com> |
---|---|
To: | "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | "Peter Eisentraut" <peter_e(at)gmx(dot)net>, <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: Domain Support -- another round |
Date: | 2002-03-19 02:36:34 |
Message-ID: | 030801c1ceee$e32c8ad0$8001a8c0@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Output looks good, but I always got a bunch of NOTICE statements.
I'll assume the lack of those is related to the logging changes that
have been going on?
--
Rod Taylor
This message represents the official view of the voices in my head
----- Original Message -----
From: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Rod Taylor" <rbt(at)zort(dot)ca>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>;
<pgsql-patches(at)postgresql(dot)org>
Sent: Monday, March 18, 2002 9:16 PM
Subject: Re: [PATCHES] Domain Support -- another round
>
> Patch applied. I am attaching the expected/domain.out file that I
> generated when I added your domain test file to the regression
tests.
> Please verify that the output is correct. Thanks.
>
> --------------------------------------------------------------------
-------
>
> Rod Taylor wrote:
> > New set with most of Peters comments corrected. Left the deal
about
> > schema though :) Took nearly an hour to do a cvs diff for some
reason
> > this time (normally a couple of minutes is enough).
> >
> > > Random nitpicking below. Also, have you created a regression
test?
> >
> > They had been posted a few times and haven't changed. (Attached
> > anyway)
> >
> >
> > > > + <structfield>typnotnull</structfield> represents a NOT
NULL
> > > > + constraint on a type. Normally used only for domains.
> > >
> > > And unnormally...?
> >
> > Unnormally is when someone sets it by hand on a type which isn't a
> > domain -- I guess. Corrected.
> >
> > > > + <!entity createDomain system "create_domain.sgml">
> > >
> > > I don't see this file included.
> >
> > Other messages. Full package included on this one however.
> >
> >
> >
> > > > + * MergeDomainAttributes
> > > > + * Returns a new table schema with the constraints,
types,
> > and other
> > > > + * attributes of the domain resolved for fields using
the
> > domain as
> > > > + * their type.
> > >
> > > I didn't know we had schemas yet. You should probably not
overload
> > that
> > > term to mean "a list of database objects".
> >
> > Merge attributes says something very similar about inheritance and
> > table schemas. Kinda correct considering
> > the variable used in both cases is *schema.
> >
> >
> > The diff weirdness in regards to DROP DATABASE is probably because
I
> > started by copying the DROP DATABASE element, then altered it. I
> > don't know why it chose that method to do the diff though, but it
is
> > accurate. Using -cd flags didn't make it any prettier.
>
> [ Attachment, skipping... ]
>
> [ Attachment, skipping... ]
>
> [ Attachment, skipping... ]
>
> [ Attachment, skipping... ]
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania
19026
>
----------------------------------------------------------------------
----------
> -- Test Comment / Drop
> create domain domaindroptest int4;
> comment on domain domaindroptest is 'About to drop this..';
> create domain basetypetest domaindroptest;
> ERROR: DefineDomain: domaindroptest is not a basetype
> drop domain domaindroptest;
> ERROR: parser: parse error at or near ";"
> drop domain domaindroptest restrict;
> -- TEST Domains.
> create domain domainvarchar varchar(5);
> create domain domainnumeric numeric(8,2);
> create domain domainint4 int4;
> create domain domaintext text;
> -- Test tables using domains
> create table basictest
> ( testint4 domainint4
> , testtext domaintext
> , testvarchar domainvarchar
> , testnumeric domainnumeric
> );
> INSERT INTO basictest values ('88', 'haha', 'short',
12'); -- Good
> INSERT INTO basictest values ('88', 'haha', 'short text',
'123.12'); -- Bad varchar
> ERROR: value too long for type character varying(5)
> INSERT INTO basictest values ('88', 'haha', 'short',
3.1212'); -- Truncate numeric
> select * from basictest;
> testint4 | testtext | testvarchar | testnumeric
> ----------+----------+-------------+-------------
> 88 | haha | short | 123.12
> 88 | haha | short | 123.12
> (2 rows)
>
> drop table basictest;
> drop domain domainvarchar restrict;
> drop domain domainnumeric restrict;
> drop domain domainint4 restrict;
> drop domain domaintext restrict;
> -- Array Test
> create domain domainint4arr int4[1];
> create domain domaintextarr text[2][3];
> create table domarrtest
> ( testint4arr domainint4arr
> , testtextarr domaintextarr
> );
> INSERT INTO domarrtest values ('{2,2}', '{{"a","b"}{"c","d"}}');
> INSERT INTO domarrtest values ('{{2,2}{2,2}}', '{{"a","b"}}');
> INSERT INTO domarrtest values ('{2,2}',
'{{"a","b"}{"c","d"}{"e"}}');
> INSERT INTO domarrtest values ('{2,2}', '{{"a"}{"c"}}');
> INSERT INTO domarrtest values (NULL, '{{"a","b"}{"c","d","e"}}');
> drop table domarrtest;
> drop domain domainint4arr restrict;
> drop domain domaintextarr restrict;
> create domain dnotnull varchar(15) NOT NULL;
> create domain dnull varchar(15) NULL;
> create table nulltest
> ( col1 dnotnull
> , col2 dnotnull NULL -- NOT NULL in the domain cannot be
overridden
> , col3 dnull NOT NULL
> , col4 dnull
> );
> INSERT INTO nulltest DEFAULT VALUES;
> ERROR: ExecAppend: Fail to add null value in not null attribute
col1
> INSERT INTO nulltest values ('a', 'b', 'c', 'd'); -- Good
> INSERT INTO nulltest values (NULL, 'b', 'c', 'd');
> ERROR: ExecAppend: Fail to add null value in not null attribute
col1
> INSERT INTO nulltest values ('a', NULL, 'c', 'd');
> ERROR: ExecAppend: Fail to add null value in not null attribute
col2
> INSERT INTO nulltest values ('a', 'b', NULL, 'd');
> ERROR: ExecAppend: Fail to add null value in not null attribute
col3
> INSERT INTO nulltest values ('a', 'b', 'c', NULL); -- Good
> select * from nulltest;
> col1 | col2 | col3 | col4
> ------+------+------+------
> a | b | c | d
> a | b | c |
> (2 rows)
>
> drop table nulltest;
> drop domain dnotnull restrict;
> drop domain dnull restrict;
> create domain ddef1 int4 DEFAULT 3;
> create domain ddef2 oid DEFAULT '12';
> -- Type mixing, function returns int8
> create domain ddef3 text DEFAULT 5;
> create sequence ddef4_seq;
> create domain ddef4 int4 DEFAULT nextval(cast('ddef4_seq' as text));
> create domain ddef5 numeric(8,2) NOT NULL DEFAULT '12.12';
> create table defaulttest
> ( col1 ddef1
> , col2 ddef2
> , col3 ddef3
> , col4 ddef4
> , col5 ddef1 NOT NULL DEFAULT NULL
> , col6 ddef2 DEFAULT '88'
> , col7 ddef4 DEFAULT 8000
> , col8 ddef5
> );
> insert into defaulttest default values;
> insert into defaulttest default values;
> insert into defaulttest default values;
> select * from defaulttest;
> col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8
> ------+------+------+------+------+------+------+-------
> 3 | 12 | 5 | 1 | 3 | 88 | 8000 | 12.12
> 3 | 12 | 5 | 2 | 3 | 88 | 8000 | 12.12
> 3 | 12 | 5 | 3 | 3 | 88 | 8000 | 12.12
> (3 rows)
>
> drop sequence ddef4_seq;
> drop table defaulttest;
> drop domain ddef1 restrict;
> drop domain ddef2 restrict;
> drop domain ddef3 restrict;
> drop domain ddef4 restrict;
> drop domain ddef5 restrict;
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-03-19 02:44:23 | Re: Domain Support -- another round |
Previous Message | Neil Conway | 2002-03-19 02:35:51 | Re: Again, sorry, caching. |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-03-19 02:44:23 | Re: Domain Support -- another round |
Previous Message | Bruce Momjian | 2002-03-19 02:32:57 | Re: psql domains |