public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurent Buffat <[email protected]>
To: [email protected]
Subject: quote text array
Date: Wed, 9 Jul 2008 19:46:17 +0200
Message-ID: <[email protected]> (raw)

Hi,

I would like to know how to allways quote all the string in the result  
of a select for a text array ?

Here is some code :

CREATE TABLE textarray ( name text[] );
INSERT INTO textarray VALUES ( '{ab,cd}');
INSERT INTO textarray VALUES ( '{a''b,cd}');
INSERT INTO textarray VALUES ( '{"a,b",cd}');
INSERT INTO textarray VALUES( array['a"b','cd']);
SELECT * FROM textarray;
    name
------------
  {ab,cd}
  {a'b,cd}
  {"a,b",cd}
  {"a\"b",cd}
(4 rows)


For the two last row, the first string is double quote.
Is-it possible to have alway these double quote for all the string the  
result ?

like this : (it's a artificial result)

name
------------
  {"ab","cd"}
  {"a'b","cd"}
  {"a,b","cd"}
  {"a\"b","cd"}
(4 rows)

Thanks for your help.

Laurent






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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: quote text array
  In-Reply-To: <[email protected]>

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

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox