Re: [SQL] select ... for update in plpgsql
'select ... for update' needs to be inside a transaction. plpgsql cannot start or end transactions. 'begin' and 'end' are not transaction statements. (read the docs). -Cedar On Fri, 20 Apr 2001, Jie Liang wrote: > > Hi, > > I have a question about 'select ... for update'; > according to the docs, > clause 'for update' will lock selected rows, > I believe it should be put into a > begin; > select ... for update; > update ...; > end; > block. > > however, if I use it in a plpgsql function, > do I need another pair of begin...end? > or say begin...end in plpgsql can lock chosen rows until > updated ALL ROWS? > if not, do you have any suggestion? > > > > Jie LIANG > > St. Bernard Software > > 10350 Science Center Drive > Suite 100, San Diego, CA 92121 > Office:(858)320-4873 > > [EMAIL PROTECTED] > www.stbernard.com > www.ipinc.com > > > > ---(end of broadcast)--- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) > ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] Timezone conversion
Umm.. define 'it'. (Isn't current_timestamp or now() already a timestamp?) select CURRENT_TIMESTAMP, CURRENT_TIMESTAMP-2*3600; timestamp| ?column? + 2001-04-24 13:06:11+03 | 1981-08-07 I also have a question.. How, for example, would I add 90 days to the current timestamp? Thanks, -Cedar On Thu, 19 Apr 2001, Grant wrote: > Convert it to timestamp and minus TIMEZONE * 3600... > > On Wed, 11 Apr 2001, Roberto Mello wrote: > > > Hi, > > > > How can I do timezone conversions in PG? I looked on the docs and > > couldn't find how. I want to find the current time in another timezone. > > > > Thanks, > > > > -Roberto > > > > P.S: This type of function would be excellent on the cookbook > > (www.brasileiro.net). > > > > > ---(end of broadcast)--- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl > ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
RE: [SQL] Timezone conversion
Hi Cedar, Does this help? select CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + '90 days'; timestamp|?column? + 2001-04-24 12:57:56+01 | 2001-07-23 12:57:56+01 > > I also have a question.. How, for example, would I add 90 days to the > current timestamp? > > Thanks, > -Cedar ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[SQL] Table corrupted and data lost (second time in one month!!)
This is the second time in this month FATAL 1: Memory exhausted in AllocSetAlloc() pqReadData() -- backend closed the channel unexpectedly. This probably means the backend terminated abnormally before or while processing the request. A table has been corrupted and i don't know why... It's really hard to recover the table, and last time i lost some data ;-( Someone can help me to solve this problem ??? I don't want this table corrupted anymore The postgres version is 7.0.2 ... The aplication is CGI-Perl based, using DBI. The system is Mandrake 7.0, and the hardware a K6-2, 64Mb, 10Gb, etc... It runs without X. Thanks !! -- Fernando Moyano Frase del día: -- Este tagline es shareware. Envia 1000 pts para registrarlo. (*) SymeX ==> http://symex.lantik.com (*) WDBIL ==> http://wdbil.sourceforge.net (*) Informate sobre LINUX en http://www.linux.org ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Table corrupted and data lost (second time in one month!!)
Fernando, > A table has been corrupted and i don't know why... > It's really hard to recover the table, and last time i lost some data > ;-( > > Someone can help me to solve this problem ??? I don't want this table > corrupted anymore My first thought would be hardware problems. Have you tried doing a full sector-by-sector scan on that HDD, or better yet, moving the whole database to an alternate server? BTW, I run Postgres on top of ReiserFS, which cuts down my disk errors significantly. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small businessesfax 621-2533 and non-profit organizations. San Francisco ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[SQL] RE:Table corrupted and data lost (second time in one month!!)
Previously... >FATAL 1: Memory exhausted in AllocSetAlloc() >pqReadData() -- backend closed the channel unexpectedly. >This probably means the backend terminated abnormally >before or while processing the request. > >A table has been corrupted and i don't know why... >It's really hard to recover the table, and last time i lost some data ;-( > I have never used 7.0.2 for any length of timebut I would recommend upgrading to 7.1 - many bugs have been fixed in this release - and hopefully not too many more introduced :) also adding more RAM would be a good idea, as 64Mb is not much these days ( I use apache 1.3.19 + mod perl 1.25 and regularly see 150Mb RSS when I run gtop ) This may be a Red Herring, but check to see you are not exhausing your swap space, as all sorts of odd errors can be encouraged by this... Cheers Mark ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])