Re: [GENERAL] express composite type literal as text

2015-02-27 Thread Jim Nasby
On 2/21/15 7:35 PM, Eric Hanson wrote: Hi, I'm trying to use a composite type in a WHERE clause, as described here: http://www.postgresql.org/docs/9.4/static/rowtypes.html Just pasting in the examples I get: CREATE TYPE complex AS ( r double precision, i double

Re: [GENERAL] express composite type literal as text

2015-02-23 Thread Merlin Moncure
On Sat, Feb 21, 2015 at 4:58 PM, Eric Hanson e...@aquameta.com wrote: Hi, I'm trying to use a composite type in a WHERE clause, as described here: http://www.postgresql.org/docs/9.4/static/rowtypes.html Just pasting in the examples I get: CREATE TYPE complex AS ( r double

[GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
Hi, How do I express a composite type literal as text? I'm trying to use a composite type in a WHERE clause. The examples in the docs http://www.postgresql.org/docs/9.4/static/rowtypes.html say: CREATE TYPE complex AS ( r double precision, i double precision ); CREATE

Re: [GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
On Sun, Feb 22, 2015 at 11:42 AM, Adrian Klaver adrian.kla...@aklaver.com wrote: test= select * from on_hand where item = '(fuzzy dice,42,1.99)'::inventory_item; item | count +--- (fuzzy dice,42,1.99) | 1000 (1 row) So, you have to do

Re: [GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
On Sun, Feb 22, 2015 at 11:47 AM, Tom Lane t...@sss.pgh.pa.us wrote: Eric Hanson elhan...@gmail.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

Re: [GENERAL] express composite type literal as text

2015-02-22 Thread Andrew Sullivan
On Sun, Feb 22, 2015 at 12:18:21PM -0800, Eric Hanson wrote: Got it. Ok, I'm reporting this as a bug. Is this a bug? Being able to always express literals as text is a really valuable assumption to be able to rely on. If I had to guess (I guess someone more authoritative than I will chime

Re: [BUGS] [GENERAL] express composite type literal as text

2015-02-22 Thread Tom Lane
Eric Hanson elhan...@gmail.com writes: On Sun, Feb 22, 2015 at 11:47 AM, Tom Lane t...@sss.pgh.pa.us wrote: 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

Re: [GENERAL] express composite type literal as text

2015-02-22 Thread Adrian Klaver
On 02/22/2015 10:07 AM, Eric Hanson wrote: Hi, How do I express a composite type literal as text? I'm trying to use a composite type in a WHERE clause. The examples in the docs http://www.postgresql.org/docs/9.4/static/rowtypes.html say: CREATE TYPE complex AS ( r

Re: [GENERAL] express composite type literal as text

2015-02-22 Thread Tom Lane
Eric Hanson elhan...@gmail.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

Re: [GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
On Sun, Feb 22, 2015 at 11:42 AM, Adrian Klaver adrian.kla...@aklaver.com wrote: test= select * from on_hand where item = '(fuzzy dice,42,1.99)'::inventory_item; item | count +--- (fuzzy dice,42,1.99) | 1000 (1 row) So, you have to do

Re: [BUGS] [GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
On Sun, Feb 22, 2015 at 12:56 PM, Tom Lane t...@sss.pgh.pa.us wrote: Well, it's an unimplemented feature anyway. I poked into it and noticed that the equivalent case for arrays works, because that operator is anyarray = anyarray. enforce_generic_type_consistency() observes that we have an

[GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
Hi, I'm trying to use a composite type in a WHERE clause, as described here: http://www.postgresql.org/docs/9.4/static/rowtypes.html Just pasting in the examples I get: CREATE TYPE complex AS ( r double precision, i double precision ); CREATE TYPE inventory_item AS (

[GENERAL] express composite type literal as text

2015-02-22 Thread Eric Hanson
Hi, I'm trying to use a composite type in a WHERE clause, as described here: http://www.postgresql.org/docs/9.4/static/rowtypes.html Just pasting in the examples I get: CREATE TYPE complex AS ( r double precision, i double precision ); CREATE TYPE inventory_item AS (