Quantcast

Under what condition can RDB$RELATION_TYPE be NULL?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Under what condition can RDB$RELATION_TYPE be NULL?

Mark Rotteveel-2
A bug was just reported for Jaybird 3
(http://tracker.firebirdsql.org/browse/JDBC-494); I made changes to use
RDB$RELATION_TYPE to discriminate between the different relation types,
but apparently it can be null under some conditions.

What are those conditions, or would this be a bug in Firebird if it is
null?

Mark

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Under what condition can RDB$RELATION_TYPE be NULL?

Dmitry Yemanov-3
16.05.2017 22:14, Mark Rotteveel wrote:

> A bug was just reported for Jaybird 3
> (http://tracker.firebirdsql.org/browse/JDBC-494); I made changes to use
> RDB$RELATION_TYPE to discriminate between the different relation types,
> but apparently it can be null under some conditions.
>
> What are those conditions, or would this be a bug in Firebird if it is
> null?

Perhaps a restore from some ancient version could leave this field being
NULL. The engine treats NULL as 0 (aka PERSISTENT), so it shouldn't hurt.


Dmitry


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Under what condition can RDB$RELATION_TYPE be NULL?

Mark Rotteveel-2
On 2017-05-16 21:19, Dmitry Yemanov wrote:

> 16.05.2017 22:14, Mark Rotteveel wrote:
>
>> A bug was just reported for Jaybird 3
>> (http://tracker.firebirdsql.org/browse/JDBC-494); I made changes to
>> use
>> RDB$RELATION_TYPE to discriminate between the different relation
>> types,
>> but apparently it can be null under some conditions.
>>
>> What are those conditions, or would this be a bug in Firebird if it is
>> null?
>
> Perhaps a restore from some ancient version could leave this field
> being
> NULL. The engine treats NULL as 0 (aka PERSISTENT), so it shouldn't
> hurt.

But it does hurt if you have a condition: "where rdb$relation_type = 0"
(or in this case: "where rdb$relation_type in (0, 3)"; shouldn't the
restore fix this up and make NULL explicit 0?

Mark

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Under what condition can RDB$RELATION_TYPE be NULL?

Leyne, Sean


> shouldn't the restore fix this up and make NULL explicit 0?

gbak is not a special process, it is restricted the same as user connections, so with v3+ it would not be able to execute any DML operations on system tables.


Sean

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Under what condition can RDB$RELATION_TYPE be NULL?

Dmitry Yemanov-3
17.05.2017 01:02, Leyne, Sean wrote:
>
> gbak is not a special process, it is restricted the same as user connections, so with v3+ it would not be able to execute any DML operations on system tables.

gbak is a special process and it does work with system tables directly.


Dmitry


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Under what condition can RDB$RELATION_TYPE be NULL?

Dmitry Yemanov-3
In reply to this post by Mark Rotteveel-2
16.05.2017 22:27, Mark Rotteveel wrote:
>
> But it does hurt if you have a condition: "where rdb$relation_type = 0"
> (or in this case: "where rdb$relation_type in (0, 3)"; shouldn't the
> restore fix this up and make NULL explicit 0?

Historically, many system fields inherit this behaviour and should be
handled using coalesce(field, 0), so this case is not unique. That said,
we can surely fix it up during restore. Please create a ticket.


Dmitry


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Under what condition can RDB$RELATION_TYPE be NULL?

Mark Rotteveel-2
On 17-5-2017 06:32, Dmitry Yemanov wrote:
> 16.05.2017 22:27, Mark Rotteveel wrote:
>>
>> But it does hurt if you have a condition: "where rdb$relation_type = 0"
>> (or in this case: "where rdb$relation_type in (0, 3)"; shouldn't the
>> restore fix this up and make NULL explicit 0?
>
> Historically, many system fields inherit this behaviour and should be
> handled using coalesce(field, 0), so this case is not unique. That said,
> we can surely fix it up during restore. Please create a ticket.

http://tracker.firebirdsql.org/browse/CORE-5543

--
Mark Rotteveel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Loading...