Skip to content

BUG: The CONTAINS ADQL function, in a WHERE clause, is correctly translated to PostgresSQL only if appears in a certain order #19

@burnout87

Description

@burnout87

Hi,

considering the following ADQL query example:

SELECT TOP 100 * FROM ivoa.obscore WHERE (1 = CONTAINS(POINT('ICRS', s_ra, s_dec),CIRCLE('ICRS', 81, 21, 10)))

this is translated to PostgresSQL correctly as:

SELECT * FROM ivoa.obscore WHERE (spoint(RADIANS(s_ra), RADIANS(s_dec)) @ scircle(spoint(RADIANS(81.0), RADIANS(21.0)), RADIANS(10.0))) LIMIT 100;'

And it runs correctly.

But, if the same query is written in the following way:

SELECT TOP 100 * FROM ivoa.obscore WHERE (CONTAINS(POINT('ICRS', s_ra, s_dec),CIRCLE('ICRS', 81, 21, 10)) = 1)

this is translated to PostgresSQL as:

SELECT * FROM ivoa.obscore WHERE (spoint(RADIANS(s_ra), RADIANS(s_dec)) @ scircle(spoint(RADIANS(81.0), RADIANS(21.0)), RADIANS(10.0)) = 1) LIMIT 100;

which, when run, throws the following error:

ERROR:  operator does not exist: boolean = integer
LINE 1: ...int(RADIANS(81.0), RADIANS(21.0)), RADIANS(10.0)) = 1) LIMIT...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts. 

SQL state: 42883
Character: 136

Can you also verify and reproduce this behavior?

Thanks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions