pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: R.K.Street@rl.ac.uk
To: pgsql-sql@postgresql.org
Subject: SQL type conversion - text to char/varchar
Date: Mon, 28 Sep 1998 10:48:14 +0100 (BST)
Message-ID: <XFMail.980928110054.R.K.Street@rl.ac.uk> (raw)

Hello,

How do I convert text into char or varchar?
I tried using char/varchar for the basic fields but the sql below
(among others things) fails.

update table set field2 = upper(field1);

This only works if the two fields are text and not for char/varchar.
If I use text blobs then all length information is lost and java does
not seem to know that these are plain text fields with specific lengths
etc.  The manual implies that the char(text) and varchar(text) functions
should exist.  My error messages indicate that I am missing them.
Does anyone have the SQL text for these functions so I can add them
to my database?  Sorry I cannot give the exact version as psql does
not seem to have a 'version' command to tell me what it is.
Is there another way to tell what version you have.

ie/

select 'Hello'::varchar;           = okay
select field1::varchar from table; = ERROR:  function char(text) does not exist


Rachel Street

********************************************************************
* R K Street - RAL Database Systems - (01235) 821900 ext 5833      *
* Rutherford Appleton Laboratory, Chilton, DIDCOT, Oxon, UK        *
* Email: TCPIP  street@wdcc1.bnsc.rl.ac.uk or R.K.Street@rl.ac.uk  *
********************************************************************



Message-ID: <XFMail.980928110054.R.K.Street@rl.ac.uk>
Permalink:  ../XFMail.980928110054.R.K.Street@rl.ac.uk/
Also on:    postgresql.org/message-id/XFMail.980928110054.R.K.Street@rl.ac.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: R.K.Street@rl.ac.uk
  Subject: Re: SQL type conversion - text to char/varchar
  In-Reply-To: <XFMail.980928110054.R.K.Street@rl.ac.uk>
  References: <XFMail.980928110054.R.K.Street@rl.ac.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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