[SQL] Whole-row comparison ?

2007-05-17 Thread christian.roche.ext
Hi there, I'm trying to implement a "versionned" storage for a datawarehouse system, meaning I have tables which store daily information about objects and I would like to have a row inserted (i.e. a new version) only if it differs from the most recent existing row. For instance instead of storin

Re: [SQL] Whole-row comparison ?

2007-05-17 Thread christian.roche.ext
Ok I understand now that this row(t.*) syntax is new to postgres 8.2 As explained in the documentation, ยง4.2.11. Row Constructors: A row constructor can include the syntax rowvalue.*, which will be expanded to a list of the elements of the row value, just as occurs when the .* syntax is used a

[SQL] Versionning (was: Whole-row comparison)

2007-06-01 Thread christian.roche.ext
Hi all, first let me tell you that this nice "whole-row comparison" feature of postgres 8.2 allowed me to create a versionned database model very neatly. The SQL statement that inserts in the destination table only the one rows that are new or that have changed since last time is very simply wri

Re: [SQL] Versionning (was: Whole-row comparison)

2007-06-01 Thread christian.roche.ext
Hi Andrew, I must admit I don't really understand what you say. I don't know what SRF stand for, and what you say about generic case is not clear to me, sorry. My idea is that using a parameter table allows me to keep using a view, which is optimized for instance when used against a WHERE cond

Re: [SQL] Versionning (was: Whole-row comparison)

2007-06-04 Thread christian.roche.ext
Hi Andrew, what is worrying me is that if I use a SRF, any additional WHERE condition would not be taken into account before executing the underlying query, e.g., in this request using a view, the WHERE condition would be considered in the final query : UPDATE params SET version = ver_id; SELE