https://bugs.documentfoundation.org/show_bug.cgi?id=158452

Julien Nabet <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|[email protected] |[email protected]
                   |desktop.org                 |
                 CC|                            |[email protected],
                   |                            |[email protected]
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Julien Nabet <[email protected]> ---
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I noticed this on console:
warn:connectivity.firebird:558350:558350:connectivity/source/drivers/firebird/Util.cxx:58:
firebird_sdbc error:
*UPDATE operation is not allowed for system table RDB$RELATION_FIELDS
caused by
'UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = 1 WHERE RDB$FIELD_NAME = 'Name'
AND RDB$RELATION_NAME = 'Tabelle1''


Searching in the code, I see:
    159             // Dirty hack: can't change null directly in sql, we have
to fiddle
    160             // the system tables manually.
    161             if (nNullable == ColumnValue::NULLABLE)
    162             {
    163                 sSql = "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG =
NULL "
    164                        "WHERE RDB$FIELD_NAME = '" + rColName + "' "
    165                        "AND RDB$RELATION_NAME = '" + getName() + "'";
    166             }
    167             else if (nNullable == ColumnValue::NO_NULLS)
    168             {
    169                 // And if we are making NOT NULL then we have to make
sure we have
    170                 // no nulls left in the column.
    171                 OUString sFillNulls("UPDATE \"" + getName() + "\" SET
\""
    172                                     + rColName + "\" = 0 "
    173                                     "WHERE \"" + rColName + "\" IS
NULL");
    174                
getConnection()->createStatement()->execute(sFillNulls);
    175 
    176                 sSql = "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG =
1 "
    177                        "WHERE RDB$FIELD_NAME = '" + rColName + "' "
    178                        "AND RDB$RELATION_NAME = '" + getName() + "'";
    179             }
    180             getConnection()->createStatement()->execute(sSql);
(See
https://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/firebird/Table.cxx?r=299441fb#159)
This part comes from e6c4e419d6bc3572b183ca8ed3f2b75417899fff
Implement changing nullable. (firebird-sdbc)
(in 2013)

Reading
https://stackoverflow.com/questions/74477356/how-to-remove-null-constraint-for-a-column-in-firebird-2-5,
it seems due to the fact that with Firebird < 3, it wasn't possible to use
alter table to make a column nullable or not.


Since the hack doesn't seem to work anyway, let's forget FB < 3 and use alter
table syntax ; I'll give it a try.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to