[SQL] Re: timestamp bug
Cedar Cox wrote: > > There appears to be a bug in timestamp/interval addition. It happens in > both PG version 7.0.2 and 7.1. There is a duplicate day (2001 Sep 07) and > a missing day (2002 Apr 04). I discovered this by accident when I asked > the interface I'm writing for a 365 day long calendar.. Interestingly, > the missing day thing (second example) doesn't happen if only adding a few > days (like the first example). I didn't go into detail to find the point > at which it does happen. IMN1=# SELECT version(); version --- PostgreSQL 7.1.1 on i686-pc-linux-gnu, compiled by GCC 2.95.3 (1 row) And all right work. Try new version. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[SQL] Re: Transposing data
Hans-J?rgen Sch?nig wrote: > I want the values in column label to be displayed in the a-axis. Is > there an easy way to transform the data: > Here is the input data: > age_code | label | count > --+---+--- > age_1| 30k | 1 > age_1| 50k | 2 > age_1| more | 2 > age_2| 40k | 2 > age_3| 40k | 1 > > I want the result to be: > > age_code | 30k | 40k | 50k | more > --- > age_1 | 1 | |2 | 1 > age_2 | | 2 | > age_3 | | 1 | | > > Is there any easy way to do the job or do I have to write a PL/pgSQL > function? Got it: # SELECT * FROM aaa; age_code | label | count --+---+--- age_1| 30k | 1 age_1| 50k | 2 age_1| more | 2 age_2| 40k | 2 age_3| 40k | 1 --- SELECT s0.age_code, (SELECT count FROM aaa s1 WHERE s1.age_code = s0.age_code AND s1.label = '30k') as "30k", (SELECT count FROM aaa s1 WHERE s1.age_code = s0.age_code AND s1.label = '40k') as "40k", (SELECT count FROM aaa s1 WHERE s1.age_code = s0.age_code AND s1.label = '50k') as "50k", (SELECT count FROM aaa s1 WHERE s1.age_code = s0.age_code AND s1.label = 'more') as "more" FROM aaa s0 GROUP BY s0.age_code; age_code | 30k | 40k | 50k | more --+-+-+-+-- age_1| 1 | | 2 |2 age_2| | 2 | | age_3| | 1 | | (3 rows) Alexander Dederer. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[GENERAL] Re: Return cursor
Can you send PL/SQL code and back-end code used this PL/SQL code? Myself trubles with CURSOR I resolve use LIMIT ... OFFSET ... Alla wrote: > I am porting our database from Oracle to PostgreSQL > > I know quite a lot about Oracle and pretty much nothing about > PostgreSQL :-)) > > I have a lot of stored procedures in Oracle that return result sets or > cursor. All I have to do there is open a cursor and calling > application can just fetch it > > Is there anyway to do the same thing in PostgreSQL? > > Please, help. So far I could not find anything ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html