Thread: RE: [GENERAL] ODBC Driver

RE: [GENERAL] ODBC Driver

From
"Jackson, DeJuan"
Date:
> > SELECT contact.contact_lname, contact.contact_fname,
> school.school_name
> > FROM contact INNER JOIN school ON contact.contact_school =
> > school.school_id;
> >
> > If I remember correctly, INNER JOIN is not yet supported in
> PostgreSQL,
> > which would explain the failure. Sorry to have accused the failure
> on the
>
> Aren't INNER JOIN's not exactly the same as what we call a 'normal'
> join?
> ie. isn't it an idea to add the syntax of an INNER JOIN to the parser
> and
> just kinda ignore it? You could have the scanner return just a ","
> (comma)
> for the INNER_JOIN token....
>
> Maarten
>
If it were only that easy it would have been implemented long ago.
The 'join clause' syntax takes the form of
    tuple_struct(1) [AS alias(1)] <JOIN_TYPE> tuple_struct(1) [AS
alias(2)] ON column_contraints
Where:
    tuple_struct  = a table name, or the result of a 'join clause'
    JOIN_TYPE =
        INNER JOIN |  -- Normal join
        LEFT [OUTER] JOIN |  -- Includes all rows from
tuple_struct(1) even if they do not satisfy the column_contraints (NULL
padded)
        RIGHT [OUTER] JOIN | -- Includes all rows from
tuple_struct(2) even if they do not satisfy the column_contraints (NULL
padded)
        FULL OUTER JOIN -- Includes all rows from tuple_struct(1
& 2) even if they do not satisfy the column_contraints (NULL padded)
    constraint_type = Same form as a WHERE clause
Which means you could easily have:
  SELECT *
    FROM ((t1 INNER JOIN t2
            ON (t1.col1 = t2.col1 AND t1.name = t2.type)) AS
j1
        INNER JOIN (t3 INNER JOIN t4
            ON (t3.col1 = t4.col1 AND t3.name = t4.type)) AS
j2
                ON j1.col1 = j2.col1) AS r1
   WHERE r1.stuff = 17 AND
         r1.kind = 'those'
   ORDER BY r1.sortCol
Which would have to be rewritten as:
  SELECT *
    FROM t1, t2, t3, t4
   WHERE t1.col1 = t2.col1 AND
        t1.name = t2.type AND
        t3.col1 = t4.col1 AND
        t3.name = t4.type AND
        t1.col1 = t3.col1 AND
       t1.stuff = 17 AND
         t3.kind = 'those'
   ORDER BY t4.sortCol

I say all this without a standard sitting in front of me and with no
formal training so I want balk at correction if I missed a point or am
misinformed, but this is what experience has told me.  (Haven't ever
actually tried that AS part of it though.)
        -DEJ