Converting int4 to varchar

From: Larry Bottorff <swprenzl(at)southwind(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Converting int4 to varchar
Date: 1999-01-05 14:45:04
Message-ID: Pine.BSI.4.02A.9901050836090.16300-100000@jasper.southwind.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm doing something very typical: I created a sequence "seq" and then
wanted to insert the NEXTVAL('seq') into a varchar field of a table to be
used as a primary key.

INSERT INTO products (prodno, ...) VALUES (NEXTVAL('seq'), 'blah',
'blah');

Where prodno is varchar. I tried a text(...) cast, but it complains of a
text-varchar mismatch. There is no varchar(...).

Apparently, this is not possible in Postgres(?).

Larry Bottorff SouthWind Internet Access, Inc.
System Programmer 120 S. Market St. Suite 300
swprenzl(at)southwind(dot)net Wichita, KS 67202
---------------------------------------------------------------------
In Wichita:(316)263-7964 Elsewhere:1-877-525-7964

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 1999-01-05 15:41:42 Re: [SQL] Triggers and sql functions not working...
Previous Message Jackson, DeJuan 1999-01-04 23:40:56 RE: [SQL] Probs with int2 in functions