Re: [SQL] Composite UNIQUE across two tables?

2008-03-12 Thread Dirk Jagdmann
> > My advise would be to have two triggers for insert/update on the site > > and users table that check the uniqueness of the username with the > > site_group. A have made some tests with inserts and updates on the > > existing users and sites and these two functions seem to work. > > I think

Re: [SQL] Composite UNIQUE across two tables?

2008-03-12 Thread Jamie Tufnell
Hi Dirk, On 3/11/08, Dirk Jagdmann <[EMAIL PROTECTED]> wrote: > I vote against duplicating site_group_id in the users table and the > proposed unique constraint with a function. Because all those might > fail, if you ever want to change the relationship between a site and a > site group. Good poi

Re: [SQL] Timestamp, epoch and a bit confusion

2008-03-12 Thread Valter Douglas Lisbôa Jr.
Thank you, very much. I pass through extract(epoch from x). On Wednesday 12 March 2008 19:58:07 Aurynn Shaw wrote: > Valter Douglas Lisbôa Jr. wrote: > > Hello all. > > > > I working with postgreSQL for a couple of months, and now I trying to > > convert timestamp columns in epoch and epoch to ti

Re: [SQL] Timestamp, epoch and a bit confusion

2008-03-12 Thread Aurynn Shaw
Valter Douglas Lisbôa Jr. wrote: Hello all. I working with postgreSQL for a couple of months, and now I trying to convert timestamp columns in epoch and epoch to timestamp columns. So far I could reach, all SQL I find by 'googling' returns an error. SELECT extract (epoch from your_time_field

[SQL] Timestamp, epoch and a bit confusion

2008-03-12 Thread Valter Douglas Lisbôa Jr.
Hello all. I working with postgreSQL for a couple of months, and now I trying to convert timestamp columns in epoch and epoch to timestamp columns. So far I could reach, all SQL I find by 'googling' returns an error. Where can I find some documentation with this convertions fo 8.2.x branch? I

Re: [SQL] case when... end in update clause?

2008-03-12 Thread Emi Lu
Hi Scott , No. I provide one small fake example. I want to know how to use case when in update/set clause as the following: update test set id = case when id = 5 then 6 else id end; Well, I think my point stands, that this stuff really belongs in a where clause. The way you're doing it

Re: [SQL] case when... end in update clause?

2008-03-12 Thread Scott Marlowe
On Wed, Mar 12, 2008 at 9:11 AM, Emi Lu <[EMAIL PROTECTED]> wrote: > >> > >> I use one small Example, table: test > >> = > >> id > >> == > >> 5 > >> 6 > >> 8 > >> > >> try to update test.id > >> > >> > >> update test > >> > >> case > >> when id

Re: [SQL] case when... end in update clause?

2008-03-12 Thread Emi Lu
I use one small Example, table: test = id == 5 6 8 try to update test.id update test case when id =5 then SET id = 6 end ; would this work: update test set id=5 where id=6; No. I provide one small fake example. I want to know how to use case w

Re: [SQL] case when... end in update clause?

2008-03-12 Thread Scott Marlowe
On Wed, Mar 12, 2008 at 8:47 AM, Emi Lu <[EMAIL PROTECTED]> wrote: > Hello, > > May I know can "case when " used by update clause. If yes, how? > > I use one small Example, table: test > = > id > == > 5 > 6 > 8 > > try to update test.id > > > update test > > c

Re: [SQL] case when... end in update clause?

2008-03-12 Thread Emi Lu
Aaron Bono wrote: On Wed, Mar 12, 2008 at 10:47 AM, Emi Lu <[EMAIL PROTECTED]> wrote: Hello, May I know can "case when " used by update clause. If yes, how? I use one small Example, table: test = id == 5 6 8 try to update test.id update test case when id =5 th

[SQL] case when... end in update clause?

2008-03-12 Thread Emi Lu
Hello, May I know can "case when " used by update clause. If yes, how? I use one small Example, table: test = id == 5 6 8 try to update test.id update test case when id =5 then SET id = 6 end ; Thanks! -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.or