Subject | Re: [firebird-support] Field informations: RDB$Null_Flag is wrong |
---|---|
Author | Ivan Prenosil |
Post date | 2006-11-18T14:03:54Z |
> I'm calling field informations via select, but I'm getting wrong answer.It seems you are looking at wrong table:
>
> CREATE TABLE KATEG_ORIGINAL (
> TEXT VARCHAR(80) NOT NULL,
> ID INTEGER DEFAULT 0 NOT NULL );
>
> IBExpert shows that really both fields are not-null. But the following
> select says that only 'ID' is not-null, but 'TEXT' would be nullable:
>
> SELECT rel.RDB$Relation_Name AS TableName,
> rel.RDB$Field_Name AS FieldName,
> rel.RDB$Field_Position AS FieldPos,
> fld.RDB$Field_Type AS FeldtypNr,
> typ.RDB$Type_Name AS Feldtyp,
> fld.RDB$Field_Length AS Laenge,
> fld.RDB$Null_Flag AS NotNull
> FROM rdb$relation_fields rel
> JOIN RDB$Fields fld
> ON rel.RDB$Field_Source = fld.RDB$Field_Name
> JOIN RDB$Types typ
> ON ( (fld.RDB$Field_Type = typ.RDB$Type)
> AND (typ.RDB$Field_Name = 'RDB$FIELD_TYPE') )
> WHERE (rel.RDB$Relation_Name = 'KOMP_ORIGINAL')
> ORDER BY RDB$Relation_Name, RDB$Field_Position
>
> I get the same wrong result with "rel.RDB$Null_Flag" instead of
> "fld.RDB$Null_Flag".
CREATE TABLE KATEG_ORIGINAL (
vs.
WHERE (rel.RDB$Relation_Name = 'KOMP_ORIGINAL')
The correct flag must be in rel.RDB$Null_Flag
Ivan
http://www.volny.cz/iprenosil/interbase/