Re: [GENERAL] Problem with complex outer join expression

2006-04-27 Thread Chris Velevitch
On 4/27/06, Bruno Wolff III <[EMAIL PROTECTED]> wrote: > I believe that has been fixed in recent version of postgres. At some point > in the past there was only a date + int operator and not an int + date > operator. > Overloading makes it easy to forget that those are two different operators. I'l

Re: [GENERAL] Problem with complex outer join expression

2006-04-27 Thread Chris Velevitch
On 4/28/06, Tom Lane <[EMAIL PROTECTED]> wrote: > Either write it as date + integer, or add an integer + date operator I thought I did it in that order, but I'll check it again. > (not very hard, just transpose the inputs), or use PG >= 8.0 which has > integer + date built in. I'm using a shared

Re: [GENERAL] Problem with complex outer join expression

2006-04-27 Thread Bruno Wolff III
On Thu, Apr 27, 2006 at 16:55:22 +1000, Chris Velevitch <[EMAIL PROTECTED]> wrote: > Seems like the problem has something to do with date arithmetic. I > can't seem to add an integer expression to a date constant. It works > if I add a integer constant to a date constant, but that's not what I >

Re: [GENERAL] Problem with complex outer join expression

2006-04-26 Thread Chris Velevitch
Seems like the problem has something to do with date arithmetic. I can't seem to add an integer expression to a date constant. It works if I add a integer constant to a date constant, but that's not what I want. I tried cast(expression as integer) + date '2006-04-09' but I get 'ERROR: operator doe

Re: [GENERAL] Problem with complex outer join expression

2006-04-26 Thread Chris Velevitch
On 4/26/06, chris smith <[EMAIL PROTECTED]> wrote: > Table joins can only be done against another table & field, I don't > think you can do it using an expression like this. That should all be > in the where clause. > > What do the timesheets and dummy_records tables look like? timesheets.weekendi

Re: [GENERAL] Problem with complex outer join expression

2006-04-26 Thread Tom Lane
"Chris Velevitch" <[EMAIL PROTECTED]> writes: > select dummy_records.sequence_nr,timesheets.weekending,timesheets.timesheet_id > from dummy_records > ,left outer join timesheets > on (timesheets.weekending = ('2006-04-09' + (integer > dummy_records.sequence_nr-1)*7))) > where dummy

Re: [GENERAL] Problem with complex outer join expression

2006-04-26 Thread chris smith
On 4/26/06, Chris Velevitch <[EMAIL PROTECTED]> wrote: > I'm using 7.4.5 on win XP Pro SP1. > > I'm getting:- > > ERROR: syntax error at or near "(" at character 155 > > from the query:- > > select dummy_records.sequence_nr,timesheets.weekending,timesheets.timesheet_id > from dummy_records >