Re: [SQL] master/detail

2012-05-22 Thread Jan Bakuwel
Hi Andreas and Mario, Many thanks for your suggestion to use PostgreSQL's window function, exactly what I needed. kind regards, Jan smime.p7s Description: S/MIME Cryptographic Signature

[SQL] master/detail

2012-05-20 Thread Jan Bakuwel
Hi, I'm trying to get my head around the following question. As an example take a table with products: productid (pk) name and productprice productpriceid (pk) productid (fk) pricedate price There are multiple records in productprice for each product as prices (often) go up and (less often) go

Re: [SQL] SELECT 1st field

2012-05-15 Thread Jan Bakuwel
Hi Misa, Tom & msi77, On 16/05/12 00:21, Misa Simic wrote: > SELECT id FROM generate_series(1,5) AS foo(id); Thanks for the suggestions - all sorted! cheers, Jan smime.p7s Description: S/MIME Cryptographic Signature

[SQL] SELECT 1st field

2012-05-14 Thread Jan Bakuwel
Hi, I've spend some time checking the documentation but haven't been able to find what I'm looking for. I've got a function that returns a set of integers and a view that selects from the function. What I need is the ability to name the column in the view, ie. create function func(i int) returns

Re: [SQL] Current transaction is aborted, commands ignored until end of transaction block

2011-12-30 Thread Jan Bakuwel
Hi, Thanks for all having responded to my mail. I understand there's no way around it at the moment so I'll have to start writing some code to deal with this behaviour. cheers! Jan smime.p7s Description: S/MIME Cryptographic Signature

Re: [SQL] Current transaction is aborted, commands ignored until end of transaction block

2011-12-30 Thread Jan Bakuwel
Hi Leif, On 30/12/11 22:44, Leif Biberg Kristensen wrote: > Fredag 30. desember 2011 09.43.38 skrev Jan Bakuwel : > >> Would be nice to have an option in PostgreSQL something along the lines >> of: 'abort-transaction-on-constraint-violation = false' > That opt

Re: [SQL] Current transaction is aborted, commands ignored until end of transaction block

2011-12-30 Thread Jan Bakuwel
Hi David, > Start a "savepoint" before each sub-update and rollback to the savepoint if > the update fails, and then try again with different data. If it succeeds you > then release the savepoint anad move on. Yeah... not ideal in my case & will result in "messy" code... Would be nice to hav

[SQL] Current transaction is aborted, commands ignored until end of transaction block

2011-12-29 Thread Jan Bakuwel
Hi, Maybe there is a simple solution for PostgreSQL behaviour that is annoying me... I've got users making updates to a master table and a number of detail tables. All changes to the master record and related detail records are encapsulated in a transaction so everything can be rolled back if nec

Re: [SQL] Different order by behaviour depending on where clause?

2011-10-29 Thread Jan Bakuwel
Hi Phil, Thanks for your reply. On 28/10/11 23:25, Phil Couling wrote: > Hi Jan > > It is my understanding that a select query without "order by" has an > undefined order. > Though I'm sure you understand the dangers of using something which is > undefined, I'm going reiterate them here: I thin

[SQL] Different order by behaviour depending on where clause?

2011-10-27 Thread Jan Bakuwel
Hi, I have a compound query with some grouping, having and order by's saved as a view, say with name "myview". A) select * from "myview" returns the results as expected in the correct order (the order by is on fields "Category", "Year", "Month" and a few other fields). The results are correctly o