Re: [SQL] many-to-many relationship

2008-10-08 Thread Louis-David Mitterrand
On Tue, Oct 07, 2008 at 05:16:39PM -0700, Steve Midgley wrote: > > I think the relationship tables method works pretty well but I have > another suggestion. You could store the Foreign table name within image > table as well as the Foreign key. > > |id|image_url|f_table|f_key > |1 |url..|pe

[SQL] 100% CPU at concurent access

2008-10-08 Thread Sabin Coanda
Hi there, I'm trying to solve the concurrent access in my database, but I found some problems. I use "PostgreSQL 8.2.4 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)"; I create the following scenario: - use an empty database - create the following table:

Re: [SQL] 100% CPU at concurent access

2008-10-08 Thread Tom Lane
"Sabin Coanda" <[EMAIL PROTECTED]> writes: > Then I try to use the following procedure to catch the concurrency access > occurence and retry until both scripts succeed: What makes you think they ever will succeed? Once one of these guys has hit a failure, you've got a tight loop of retryi

Re: [SQL] Insert a space between each character

2008-10-08 Thread Dirk Jagdmann
> Use a regular expression, e.g.: > select trim(regexp_replace('foobarbaz', '(.)', E'\\1 ', 'g')); And if we only match characters until the last character in the string, we can get rid of the outer trim(): # select regexp_replace('foobarbaz', E'(.)(?!$)', E'\\1 ', 'g'); regexp_replace