From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | eric(at)aquameta(dot)com, Eric Hanson <elhanson(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: express composite type literal as text |
Date: | 2015-02-22 19:47:52 |
Message-ID: | 31376.1424634472@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-general |
Eric Hanson <elhanson(at)gmail(dot)com> writes:
> How do I express a composite type literal as text?
The rules are given in the manual ...
> I can't use the ROW() notation, because all values need to be represented
> as text over a REST api. But I can't seem to get the text-based syntax to
> work:
> select * from on_hand where item='("fuzzy dice",42,1.99)';
> yeilds
> ERROR: input of anonymous composite types is not implemented
That message isn't telling you that you've got a problem with the data
syntax, it's telling you that you need to cast the literal to a named
composite data type. This works:
# select * from on_hand where item='("fuzzy dice",42,1.99)'::inventory_item;
item | count
------------------------+-------
("fuzzy dice",42,1.99) | 1000
(1 row)
Now, I'm not too sure *why* it's making you do that --- seems like the
default assumption ought to be that the literal is the same type as
the variable it's being compared to. Perhaps there's a bug in there,
or perhaps there's no easy way to avoid this requirement. But that's
what the requirement is today.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Eric Hanson | 2015-02-22 19:53:30 | Re: express composite type literal as text |
Previous Message | Adrian Klaver | 2015-02-22 19:42:32 | Re: express composite type literal as text |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-02-22 19:53:08 | Re: Postgres architecture for multiple instances |
Previous Message | Adrian Klaver | 2015-02-22 19:42:32 | Re: express composite type literal as text |