Wednesday, June 25, 2008

Re: [HACKERS] Creating a VIEW with a POINT column

Nope, im not ordering by the POINT column. Heres an example...

CREATE TABLE table1 (
title character varying,
sorter integer,
xy point
);

CREATE TABLE table2 (
title character varying,
sorter integer,
xy point
);

INSERT INTO table1 VALUES ('one', 1, '(1,1)');
INSERT INTO table1 VALUES ('two', 2, '(2,2)');
INSERT INTO table1 VALUES ('three', 3, '(3,3)');
INSERT INTO table2 VALUES ('four', 4, '(4,4)');
INSERT INTO table2 VALUES ('five', 5, '(5,5)');
INSERT INTO table2 VALUES ('six', 6, '(6,6)');

CREATE VIEW myview AS
SELECT table1.title, table1.sorter, table1.xy FROM table1 UNION
SELECT table2.title, table2.sorter, table2.xy FROM table2;

SELECT title FROM myview ORDER BY sorter;

ERROR: could not identify an ordering operator for type point
HINT: Use an explicit ordering operator or modify the query.

In statement:
SELECT title FROM myview ORDER BY sorter

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

No comments: