Subject | Re: [firebird-support] Left join and computed columns |
---|---|
Author | Michael Ludwig |
Post date | 2012-06-19T21:22:08Z |
Rick Debay schrieb am 19.06.2012 um 15:58 (-0400):
row, which happens to have only one column, you're expecting all fields
from the right table to be NULL because there is no matching row for the
JOIN condition. And the COMPUTED column is sort of overriding the NULL.
Did I paraphrase your thoughts correctly?
I have no idea what's the correct behaviour here. -- Michael
> Since TEST_TABLE is empty, the results should be NULL.Ah. You're expecting one row (because of the LEFT JOIN), but in that
> Changing the query to 'SELECT *' return the one row in RDB$DATABASE,
> and the column TEST_TABLE.ID is NULL and the column
> TEST_TABLE.COMPUTED_COL is "FAILED".
> If TEST_TABLE is empty, how can anything result from a join?
row, which happens to have only one column, you're expecting all fields
from the right table to be NULL because there is no matching row for the
JOIN condition. And the COMPUTED column is sort of overriding the NULL.
Did I paraphrase your thoughts correctly?
I have no idea what's the correct behaviour here. -- Michael
> > CREATE TABLE TEST_TABLE
> > (
> > ID INTEGER,
> > COMPUTED_COL VARCHAR(6) COMPUTED BY ('FAILED') );
> >
> > SELECT t.COMPUTED_COL
> > FROM RDB$DATABASE r
> > LEFT JOIN TEST_TABLE t
> > ON r.RDB$RELATION_ID = t.ID
> >
> > COMPUTED_COL
> > ------------
> > FAILED