Received: from infbssys.ips.cs.tu-bs.de (root@infbssys.ips.cs.tu-bs.de [134.169.32.1]) by hub.org (8.9.3/8.9.3) with ESMTP id EAA46083 for ; Sat, 3 Jul 1999 04:36:25 -0400 (EDT) (envelope-from mack@ips.cs.tu-bs.de) Received: from infbsdb7.idb.cs.tu-bs.de (mack@infbsdb7.idb.cs.tu-bs.de [134.169.32.137]) by infbssys.ips.cs.tu-bs.de (8.9.1/8.9.1) with ESMTP id KAA27974; Sat, 3 Jul 1999 10:36:21 +0200 From: Thomas Mack Date: Sat, 3 Jul 1999 10:36:20 +0200 (MET DST) Message-Id: <199907030836.KAA26086@infbsdb7.idb.cs.tu-bs.de> To: pgsql-sql@postgresql.org Subject: Ascii null in varchars Cc: mack@ips.cs.tu-bs.de 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