Re: [SQL] Update a composite nested type variable

2013-07-08 Thread David Johnston
Luca Vernini wrote > 2013/7/8 David Johnston < > polobo@ > > > >> >> This may be a pl/pgsql limitation but you should probably provide a >> complete >> self-contained example with your attempt so that user-error can be >> eliminated. >> >> David J. >> >> > All right. Here you are a complete exam

Re: [SQL] Update a composite nested type variable

2013-07-08 Thread Luca Vernini
2013/7/8 David Johnston > > This may be a pl/pgsql limitation but you should probably provide a > complete > self-contained example with your attempt so that user-error can be > eliminated. > > David J. > > All right. Here you are a complete example. Just tested it. Sorry for the long email. CR

Re: [SQL] Update a composite nested type variable

2013-07-08 Thread David Johnston
Luca Vernini wrote > I'm writing a system with havy use of composite types. > I have a doubt. > > I'm writing all in functions with language plpgsql. > When I read a field from a composite type I must write something like > this: > status = ((in_customer.customer_data).customer_status).status_id >

[SQL] Update a composite nested type variable

2013-07-08 Thread Luca Vernini
I'm writing a system with havy use of composite types. I have a doubt. I'm writing all in functions with language plpgsql. When I read a field from a composite type I must write something like this: status = ((in_customer.customer_data).customer_status).status_id And this works fine. I need to en

[SQL] monthly statistics

2013-07-08 Thread Andreas
Hi, I need to show a moving statistic of states of objects for every month since beginning of 2013. There are tables like objects ( id integer, name text ); state ( id integer, state text ); 10=A, 20=B ... 60=F history ( object_id integer, state_id, ts timestamp ); Every event that