Re: Possible bug? WAS :Bad (null) varchar() external representation.

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Possible bug? WAS :Bad (null) varchar() external representation.
Дата
Msg-id Pine.BSF.4.21.0101101025170.74211-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Possible bug? WAS :Bad (null) varchar() external representation.  (Justin Clift <aa2@bigpond.net.au>)
Список pgsql-sql
On Thu, 11 Jan 2001, Justin Clift wrote:

> I haven't seen a mention of a maximum number of constraints of similar
> applying to a table.  If so, then could someone please point me to it...
> 
> The reason I mention this is because I've found what seems to be causing
> this problem I'm experiencing with Postgres 7.03 :
> 
> CREATE TABLE "staff_details" (
>         "userid" character varying(24) NOT NULL,
>         "password" character(13) NOT NULL,
>         "name" character varying(96) NOT NULL,
>         "role" int2 NOT NULL,
>         "dob" date NOT NULL,
>         "phone_one" character varying(14) NOT NULL,
>         "phone_two" character varying(14),
>         "phone_three" character varying(14),
>         "address" character varying(280),
>         "status" int2,
>         "managers_notes" character varying(600),
>         CONSTRAINT "staff_details_uesrid" CHECK ((length(userid) < 25)),
>         CONSTRAINT "staff_details_password" CHECK ((length("password") <
> 14)),
>         CONSTRAINT "staff_details_name" CHECK ((length(name) < 97)),
>         CONSTRAINT "staff_details_dob" CHECK
> (date_ge(date(("timestamp"('2001-01-08'::date) - '18 years
> 00:00'::"interval")), dob)),
>         CONSTRAINT "staff_details_phone_one" CHECK ((length(phone_one) <
> 17)),
>         CONSTRAINT "staff_details_phone_two" CHECK ((length(phone_two) <
> 17)),
>         CONSTRAINT "staff_details_phone_three" CHECK
> ((length(phone_three) < 17)),
>         CONSTRAINT "staff_details_address" CHECK ((length(address) <
> 281)),
>         CONSTRAINT "staff_details_managers_notes" CHECK
> ((length(managers_notes) < 601)),
>         PRIMARY KEY ("userid")
> );
> 
> When I attempt to insert data into this table, I get the following error
> :
> 
> foobar=# insert into staff_details values ('0000111122223333',
> encrypt('foo'), 'Joshua', 1, '1970-07-01', '(03) 9867 5432', '(041) 309
> 2819', NULL, '1 Blankety-Blank Way\nBazzville', NULL, NULL);
> 

Current source seem to insert fine (don't have a 7.0 system to test on
anymore).  Also, aren't alot of these length checks meaningless?  I think
the values are converted to the correct type first, so the phone number
really shouldn't possibly be longer than 16 since it's a varchar(14).



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tulio Oliveira
Дата:
Сообщение: Re: Using a rule as a trigger.
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Using a rule as a trigger.