Error message that is a bit misleading / weird result from || null - Mailing list pgsql-bugs

From Frank van Vugt
Subject Error message that is a bit misleading / weird result from || null
Date
Msg-id 200706221501.12227.ftm.van.vugt@foxi.nl
Whole thread Raw
Responses Re: Error message that is a bit misleading / weird result from || null  (Gregory Stark <stark@enterprisedb.com>)
Re: Error message that is a bit misleading / weird result from || null  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi,


While trying to find a way to get indexed access to a table based on it's
xmin, I ran into the following error message that seems a bit misleading:


db=# select xmin || ' ' from <anytable> limit 1;
ERROR:  array value must start with "{" or dimension information


Toying a bit more with this result resulted in:

megafox=# select xmin || null from <anytable> limit 1;
  ?column?
------------
 {12115328}
(1 row)


As it seems, the result is actually a correct array:

db=# select (xmin || null)[1] from <anytable> limit 1;
 ?column?
----------
 12115328
(1 row)

And comparing the result to for example an int, works.



Now I understand that there are no standard casts of xid to something else,
but the interpretation if this concatenation surprised at least me ;)


Sidenote: since it does solve my problem, I can now build an index based on
such an interpretation of xmin, I'm a bit anxious as to how this will
be 'fixed', if at all ;)



db=# select version();
                                version
------------------------------------------------------------------------
 PostgreSQL 8.2.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.3
(1 row)






--
Best,




Frank.

pgsql-bugs by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: BUG #3403: ver 8.2 can't add serial column to temp table,but 8.1 can
Next
From: Frank van Vugt
Date:
Subject: Error message that is a bit misleading / weird result from || null