quote text array - Mailing list pgsql-docs

From Laurent Buffat
Subject quote text array
Date
Msg-id 290B018E-D49A-4203-B85A-6D1A2BAADF8B@altrabio.com
Whole thread Raw
List pgsql-docs
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



pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Backslash Escape Sequences
Next
From: James Robinson
Date:
Subject: plpgsql, declare blocks, and '=' versus ':='