Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-07-01 Thread Chris Spotts
> > > > Wouldn't you just be looking for something like: > > > > BEGIN; > > EXECUTE 'insert into forums_readposts values ('...')'; > >EXCEPTION when unique_violation THEN > >EXECUTE 'update forums_readposts set lastpostread = > '...' '; > > END; > > The logic as i read you

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-30 Thread APseudoUtopia
On Mon, Jun 29, 2009 at 2:26 PM, David Kerr wrote: > On Sat, Jun 27, 2009 at 08:23:26PM -0400, APseudoUtopia wrote: > - Hey list, > - > - I'm migrating my site away from MySQL to PostgreSQL. So far, it's been > - going great. However, there's one problem I've been having trouble > - solving. > - >

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-29 Thread David Kerr
On Sat, Jun 27, 2009 at 08:23:26PM -0400, APseudoUtopia wrote: - Hey list, - - I'm migrating my site away from MySQL to PostgreSQL. So far, it's been - going great. However, there's one problem I've been having trouble - solving. - - I have a query which allows users to "Catch up" on read posts o

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-29 Thread Lennin Caro
--- On Mon, 6/29/09, Tguru wrote: > From: Tguru > Subject: Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql > function > To: pgsql-general@postgresql.org > Date: Monday, June 29, 2009, 1:33 PM > > To migrate the site, you can use an open source

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-29 Thread Tguru
To migrate the site, you can use an open source ETL tool. Talend Open Studio is an open source ETL tool for data integration and migration experts. It's easy to learn for a non-technical user. What distinguishes Talend, when it comes to business users, is the tMap component. It allows the user to

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-28 Thread Justin
APseudoUtopia wrote: thread, then logs out (intending to read all the other forum threads at some point in the future when they log in again). If I used a VIEW, it would automatically consider all those unread forum posts to be read when the user logs out. That wouldn't work. What if a

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-28 Thread APseudoUtopia
On Sat, Jun 27, 2009 at 9:13 PM, justin wrote: > APseudoUtopia wrote: > > Hey list, > > I have a query which allows users to "Catch up" on read posts on the > forum. It works by either updating or inserting the "last post read" > number from every forum thread into the readposts table (for that > u

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-27 Thread Greg Stark
On Sun, Jun 28, 2009 at 2:13 AM, justin wrote: > > if you want to do something like this either do a test first to see if the > key is present in the table, update or do an insert like this > There is no reason to do a loop in the function waiting for a lock to > clear.   Postgresql Locks do not wo

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-27 Thread Martin Gainty
quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Sat, 27 Jun 2009 21:13:23 -0400 From: jus...@emproshunts.com To: apseudouto...@gmail.com; pgsql-general@po

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-27 Thread justin
APseudoUtopia wrote: Hey list, I have a query which allows users to "Catch up" on read posts on the forum. It works by either updating or inserting the "last post read" number from every forum thread into the readposts table (for that userid and threadid combination, of course). Here's the

[GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-27 Thread APseudoUtopia
Hey list, I'm migrating my site away from MySQL to PostgreSQL. So far, it's been going great. However, there's one problem I've been having trouble solving. I have a query which allows users to "Catch up" on read posts on the forum. It works by either updating or inserting the "last post read" nu