pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedBad (null) varchar() external representation
2+ messages / 2 participants
[nested] [flat]
* Bad (null) varchar() external representation
@ 2001-01-10 18:12 Justin Clift <aa2@bigpond.net.au>
0 siblings, 1 reply; 2+ messages in thread
From: Justin Clift @ 2001-01-10 18:12 UTC (permalink / raw)
To: pgsql-sql
Hi all,
I'm getting the following problem when trying to do a simple insert
statement...
"Bad (null) varchar() external representation"
WHY?
I'm running PostgreSQL 7.03 on Linux Mandrake 7.2 (using a specially
compiled version, not an RPM).
Here's the table :
foobar=# \d staff_details
Table "staff_details"
Attribute | Type | Modifier
----------------+--------------+----------
userid | varchar(24) | not null
password | char(13) |
name | varchar(96) |
role | smallint |
dob | date |
phone_one | varchar(14) |
phone_two | varchar(14) |
phone_three | varchar(14) |
address | varchar(280) |
status | smallint |
managers_notes | varchar(600) |
Index: staff_details_pkey
Constraints: (length(userid) < 25)
(length("password") < 14)
(length(name) < 97)
(length(phone_one) < 17)
(length(phone_two) < 17)
(length(phone_three) < 17)
(length(address) < 281)
(length(managers_notes) < 601)
foobar=# insert into staff_details values ('A', NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
ERROR: Bad (null) varchar() external representation
foobar=# insert into staff_details (userid, password, name, role, dob,
phone_one) values ('0000111122223333', 'foobarbaz1234', 'Joshua', 1,
'1970-07-01', '(03) 9867 5432');
ERROR: Bad (null) varchar() external representation
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);
ERROR: Bad (null) varchar() external representation
etc...
I've tried everything I can think of, also exported and reloaded the
database, etc. This is a new table with nothing in it.
This is driving me nuts. :-(
+ Justin Clift
Database Administrator
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Bad (null) varchar() external representation
@ 2001-01-11 18:53 Tom Lane <tgl@sss.pgh.pa.us>
parent: Justin Clift <aa2@bigpond.net.au>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2001-01-11 18:53 UTC (permalink / raw)
To: Justin Clift <aa2@bigpond.net.au>; +Cc: pgsql-sql
Justin Clift <aa2@bigpond.net.au> writes:
> "Bad (null) varchar() external representation"
This is a known stupidity in 7.0.* and before: length(varchar) doesn't
like NULLs:
play=> select length(null::varchar);
ERROR: Bad (null) varchar() external representation
It's fixed for 7.1. If it's really bothering you in 7.0.*, find that
error string in src/backend/utils/adt/varchar.c and change the code to
return 0 instead of raising an error for NULL input.
But, as someone else pointed out, the constraint expressions you are
using are redundant anyway, given the declared column length limits.
Getting rid of the constraints might be your easiest workaround for now.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-01-11 18:53 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-01-10 18:12 Bad (null) varchar() external representation Justin Clift <aa2@bigpond.net.au>
2001-01-11 18:53 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox