Re: [GENERAL] Stable sort?

2006-11-08 Thread redhog
> I don't see how it could be: >SELECT * FROM (SELECT * FROM a ORDER BY x DESC) AS B ORDER BY x ASC; That is a rather different query. My question was if the order of two elements whose internal order is not affected by the current ordering clause, still may change places due to technicalitie

[GENERAL] Stable sort?

2006-11-07 Thread redhog
Is sorting in PostgreSQL stable over subqueries, that is, is select * from (select * from A order by x) as B order by y; equivalent with select * from A order by y, x; ? ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] X.50x OID representation

2006-11-07 Thread redhog
> Looks like something for ltree, which is a datatype for storing > tree-structured data. > > http://projects.commandprompt.com/public/pgsql/browser/trunk/pgsql/contrib/ltree/README.ltree Unfourtunately, ltree seems to compare node labels in lexicographic order: "have their usual meanings. Compa

[GENERAL] X.50x OID representation

2006-11-07 Thread redhog
I need to save something very similar to X.50x IOD:s, that is, paths where the path-components are numbers. For example: 10.5.5003.24.35. Futhermore, I need to sort these in numerical path order, so that if two paths are compared according to the first path component that differs, and this path co

Re: [GENERAL] help with a query

2006-11-05 Thread redhog
If you do not want to amend your table with extra information, this is how you do it: Suppose you have a table create table events ( time timestamp, object int refers objects(id), -- The thing that had its ignition turned on or off at this time ignition boolean, comment varchar ); You can th

Re: [GENERAL] Counting records in a PL/pgsql cursor

2006-11-03 Thread redhog
> Nope, the query is way too expensive to run it twice. (GIN scan over > well over half a million rows. It's faster to do the > get-as-cursor-then-loop-and-increment, I've measured that) Can't you select into a temporary table and then do select count(*) over that table, aswell as run your cursor

Re: [GENERAL] new and old not available in rule subselects?

2006-11-03 Thread redhog
> select count(*) from new ??? - new refers to a record not a table name In the description in the manual, new and old are described as relations... Also, isn't the point that the query is rewritten into the new query with rules, thus if you update more than one row, new should be all the updated