pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Mack <mack@ips.cs.tu-bs.de>
To: pgsql-sql@postgresql.org
Cc: mack@ips.cs.tu-bs.de
Subject: Ascii null in varchars
Date: Sat, 3 Jul 1999 10:36:20 +0200 (MET DST)
Message-ID: <199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de> (raw)

We try to migrate some projects from commercial Ingres to postgres.

One problem we found:

varchars can hold any byte from \000 to \377. In Ingres we could
specify all these characters as a hex-string, e.g. X'4163006341',
meaning a string "Ac\000cA".

Construction of varchars in postgres do obviously not know of
any comparable method, this means, saying:

   select char_length(varchar 'ab\000defghi');

will result in 2 and not in 9 as expected. I can somehow understand,
why it works this way, so I came to the thought of saying instead:

   select char_length(translate(varchar 'abcdefghi','c','\000'));

which returns '9' as expected.

But this is really not nice...


The documentation does not tell anything about constructions of
varchars (or char / text) beyond this '||', the mentioned functions
do also not give any hint - does it mean, there is no such facility
(in 6.4.2)?


We would like to hear some comments,

Thank you anyway,

Thomas Mack
TU Braunschweig, Abt. Informationssysteme



Message-ID: <199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de>
Permalink:  ../199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de/
Also on:    postgresql.org/message-id/199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de

 · 

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: mack@ips.cs.tu-bs.de
  Subject: Re: Ascii null in varchars
  In-Reply-To: <199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de>
  References: <199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de>

* 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