| From: | Maciek Sakrejda <msakrejda(at)truviso(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Nested literal parsing rules? |
| Date: | 2010-09-22 17:36:02 |
| Message-ID: | AANLkTiky_YX-LidwZDr1DCokL6ssjjWbTnm7uk2Pv-Jt@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
I have a UDT:
CREATE TYPE foo AS (a integer, b integer, c hstore);
I need to construct the literal representation of an array of these
for input to a textual COPY. The hstore escaping rules are fairly
clear (I can quote all keys and values with double quotes, and escape
double quotes in keys and values with a backslash (two backslahses,
actually, due to standard_conforming_strings being off). Putting this
into my UDT literal is also fairly clear (I quote the full hstore
literal with double quotes, I double the double quotes around hstore
keys and values, and add four more backslashes (one for the hstore
literal, one for the UDT literal, and double that for
standard_conforming_strings). So each quote in an hstore key or value
is preceded by six backslashes (and each backslash is preceded by
seven). However, this is where I get lost. I tried following both the
array docs and trying to reverse engineer the behavior by using the
ARRAY[...] syntax, but I can't figure out the logic. Any suggestions
(other than to run screaming from this affront to proper relational
design--I have my reasons for it)?
Thanks,
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Francisco Reyes | 2010-09-22 17:48:21 | Re: Kill -9 for a session process caused all the sessions to be killed |
| Previous Message | Whit Armstrong | 2010-09-22 17:35:28 | file output via trigger/queue |