--- Adrian Holovaty <postgres@holovaty.com> wrote:
> Bryan Irvine wrote:
> > insert into phonenumbers values (425, 888, 0773);
> >
> > dncl=# select * from phonenumbers;
> > areacode | prefix | suffix
> > ----------+--------+--------
> > 425 | 888 | 773
> >
> > Any ideas? Do I need to change the format of the
> fields again?
>
> Put quotes around the values you're inserting, like
> this:
>
> INSERT INTO phonenumbers VALUES ('425', '888',
> '0773');
The general rule is, string values should be single
quoted, numbers should not be quoted. What appears to
be happening here is that the input is being parsed as
a number (probably int4), then cast silently to
varchar before being inserted.
Considering the strictness that PostgreSQL generally
uses with datatypes, I am slightly stunned to witness
this behaviour. I would have thought that at least a
notice was warranted, if not an outright error.
But: follow the "rules", and you'll be ok.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com