Subject | Re: [ib-support] Migrating to FB 1.0 (key size problem) |
---|---|
Author | Herbert.Augustiny@sptroth.com |
Post date | 2002-03-22T09:12:25Z |
Thank's alot for this help.
Sorry for not mentioning the systems. Im running the server on SuSE linux
(both 9.4 and 1.0)
Regards,
Herbert
|---------+---------------------------->
| | "Claudio |
| | Valderrama C." |
| | <cvalde@...> |
| | Sent by: |
| | news@....c|
| | om |
| | |
| | |
| | 22.03.2002 08:55 |
| | Please respond to|
| | ib-support |
| | |
|---------+---------------------------->
| To: ib-support@yahoogroups.com |
| cc: |
| Subject: Re: [ib-support] Migrating to FB 1.0 (key size problem) |
news:OFF6604CC3.0CC29354-ONC1256B83.0038E106-C1256B83.0039C5A5@....
.
.
and same for the new version. I'm 100% sure this is a non-Win32 platform.
At
least your 0.94 should be Linux or another port, but not Windows.
There
was a typical compile-time definition in the build process that was set
only
for some platforms. It was related to int64. The code was protected by C's
preprocessor #define directives. I discovered that only Windows had the
same
preprocessor symbol in the build scripts. This means the places protected
by
#ifdef with such symbol weren't compiled in other platform. One of the
int64
places protected by the symbol was the usage of int64 in indices!!! Since
the Linux build didn't have it, I asked the team to remove that symbol and
stop the conditional compilation. All platforms were compiled from that
point with the int64 code for indices.
What this means for you: in the past (0.94), Linux and other non-Win32
platforms calculated the size of an index for an int64 as the size for an
int32, a typical integer. This was wrong. We had a bug logged where two
int64 values would be rejected in a Unique or PK constraint if their low
part (the low DWORD) was the same. Obviously, the index wasn't of real use
for the int64 range. The index missed the other DWORD, that's 4 bytes more.
Now that's fixed, the index size is calculated correctly and the stored
values aren't truncated. Hence, your maximum varchar shrunk but you won't
get false duplicates.
truncation. You should drop the unique constraint, create a new field with
the length=188 and use the built-in substring:
update tbl set newfld = substring(oldfld from 1 for 188);
commit and drop the oldfld. If you can't, disconnect and retry.
After dropping the oldfld, do a COMMIT. Do an explicit commit or you will
clash with a bug highlighted in another thread those days here.
Use alter table again to rename the new field.
Reestablish the constraint.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sorry for not mentioning the systems. Im running the server on SuSE linux
(both 9.4 and 1.0)
Regards,
Herbert
|---------+---------------------------->
| | "Claudio |
| | Valderrama C." |
| | <cvalde@...> |
| | Sent by: |
| | news@....c|
| | om |
| | |
| | |
| | 22.03.2002 08:55 |
| | Please respond to|
| | ib-support |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|| |
| To: ib-support@yahoogroups.com |
| cc: |
| Subject: Re: [ib-support] Migrating to FB 1.0 (key size problem) |
>--------------------------------------------------------------------------------------------------------------------------------------------------|<Herbert.Augustiny@...> wrote in message
news:OFF6604CC3.0CC29354-ONC1256B83.0038E106-C1256B83.0039C5A5@....
.
.
> Hi allPlease, in the future, remember to say which platform was the old version
>
> I have a table on FB 9.4 test like this:
>
> CREATE DOMAIN ID_DOM AS NUMERIC(18,0);
>
> ID ID_DOM NOT NULL,
> Application_ID ID_DOM not null,
> Resource_Name VARCHAR(192) Character set none not null,
> Constraint Java_Resources_Unique Unique (Application_ID,
> Resource_Name),
>
> When I try to create the same table on FB 1.0 it fails with this error
> message:
> -key size exceeds implementation restriction for index "RDB$99"
> Statement failed, SQLCODE = -607
> unsuccessful metadata update
and same for the new version. I'm 100% sure this is a non-Win32 platform.
At
least your 0.94 should be Linux or another port, but not Windows.
> If I change Resource_Name from VARCHAR(192) VARCHAR(188) I can create theYes. The difference is exactly 4 bytes. You see, I'm a genius in math.
> table.
There
was a typical compile-time definition in the build process that was set
only
for some platforms. It was related to int64. The code was protected by C's
preprocessor #define directives. I discovered that only Windows had the
same
preprocessor symbol in the build scripts. This means the places protected
by
#ifdef with such symbol weren't compiled in other platform. One of the
int64
places protected by the symbol was the usage of int64 in indices!!! Since
the Linux build didn't have it, I asked the team to remove that symbol and
stop the conditional compilation. All platforms were compiled from that
point with the int64 code for indices.
What this means for you: in the past (0.94), Linux and other non-Win32
platforms calculated the size of an index for an int64 as the size for an
int32, a typical integer. This was wrong. We had a bug logged where two
int64 values would be rejected in a Unique or PK constraint if their low
part (the low DWORD) was the same. Obviously, the index wasn't of real use
for the int64 range. The index missed the other DWORD, that's 4 bytes more.
Now that's fixed, the index size is calculated correctly and the stored
values aren't truncated. Hence, your maximum varchar shrunk but you won't
get false duplicates.
> The problem now is, I've got a db on FB 9.4 that I need to port to 1.0Alter table won't let you shink a field that probably would cause data
> including the data. How can I shrink the column size of Resource_Name?
> (Alter table ... doesn't work)
truncation. You should drop the unique constraint, create a new field with
the length=188 and use the built-in substring:
update tbl set newfld = substring(oldfld from 1 for 188);
commit and drop the oldfld. If you can't, disconnect and retry.
After dropping the oldfld, do a COMMIT. Do an explicit commit or you will
clash with a bug highlighted in another thread those days here.
Use alter table again to rename the new field.
Reestablish the constraint.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/