pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
convert_numeric_to_scalar: unsupported type 354210
3+ messages / 3 participants
[nested] [flat]

* convert_numeric_to_scalar: unsupported type 354210
@ 2003-06-23 08:10  AgentM <agentm@cmu.edu>
  0 siblings, 2 replies; 3+ messages in thread

From: AgentM @ 2003-06-23 08:10 UTC (permalink / raw)
  To: pgsql-sql

PostgreSQL 7.3.2:
Here is a piece of a table definition:
CREATE TABLE data
(
id SERIAL PRIMARY KEY,
description TEXT,
ra physreal,
dec physreal,
z physreal,
...);
physreal is the domain of numeric(20,14).

Then I created an index across ra,dec, and z (one index). I really 
haven't done anything else to the database. The table has ~290000 rows 
and I indexed after inserting the data. Strangely, I can only make 
weird selects using these fields. Look:
select dec from data limit 5;
       dec
---------------
  -1.2378252250
  -1.2366515502
  -1.2501212847
  -1.0732052187
  -1.1653486998
(5 rows)

select id from data where dec < 191.456;
  id
----
   1
   2
...this works.

select id from data where dec < 2.0;
ERROR:  convert_numeric_to_scalar: unsupported type 354210

This doesn't. The problem persists even when I create individual 
indices for each column. It seems this only occurs when I use a number 
that is "close" to a value in the column. What's going on and what does 
the error mean? Thanks.


 ><><><><><><><><><
AgentM
agentm@cmu.edu





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: convert_numeric_to_scalar: unsupported type 354210
@ 2003-06-23 14:00  Rod Taylor <rbt@rbt.ca>
  parent: AgentM <agentm@cmu.edu>
  1 sibling, 0 replies; 3+ messages in thread

From: Rod Taylor @ 2003-06-23 14:00 UTC (permalink / raw)
  To: AgentM <agentm@cmu.edu>; +Cc: pgsql-sql

> select id from data where dec < 2.0;
> ERROR:  convert_numeric_to_scalar: unsupported type 354210

Domains exposed (and introduced) a number of interesting issues in
regards to type switching for these things.

Cast the 2.0 value to the domain:
	CAST(2.0 AS physreal)

or quote it and let the system figure it out:
	dec < '2.0'


Simply put, without quotes the parser assumes that 2.0 is a numeric,
which doesn't have a direct < operator for use with the domain.

Another alternative would be to create a new < operator, but thats more
work than it's worth.

This has been fixed for 7.4 (the system implicitly coerces the domain to
numeric for the index comparison).
-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachments:

  signature.asc (application/pgp-signature, 186B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: convert_numeric_to_scalar: unsupported type 354210
@ 2003-06-23 14:28  Tom Lane <tgl@sss.pgh.pa.us>
  parent: AgentM <agentm@cmu.edu>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2003-06-23 14:28 UTC (permalink / raw)
  To: AgentM <agentm@cmu.edu>; +Cc: pgsql-sql

AgentM <agentm@cmu.edu> writes:
> PostgreSQL 7.3.2:
> physreal is the domain of numeric(20,14).
> ERROR:  convert_numeric_to_scalar: unsupported type 354210

This is fixed in 7.3.3.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-06-23 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-23 08:10 convert_numeric_to_scalar: unsupported type 354210 AgentM <agentm@cmu.edu>
2003-06-23 14:00 ` Rod Taylor <rbt@rbt.ca>
2003-06-23 14:28 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox