Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique indexes do not recognise trailing space [CORE2218] #2646

Closed
firebird-automations opened this issue Nov 29, 2008 · 3 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Roddi Walker (roddi)

I have the following table:

CREATE TABLE FOO (
ID VARCHAR(20),
VAL VARCHAR(20)
);
CREATE UNIQUE INDEX I_FOO_UNQ ON FOO (ID, VAL);

I then insert a single record with no problem:
insert into foo values ('id1', 'bar');

I then insert a second record with a different VAL field (there is a space after "bar"):
insert into foo values ('id1', 'bar ');

This should be OK but I get this error (in IBExpert):
Invalid insert or update value(s): object columns are
constrained - no 2 table rows can have duplicate column values.
attempt to store duplicate value (visible to active transactions) in unique index "I_FOO_UNQ".

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

This is per SQL Standard - trailing spaces are not accounted when strings compared.
I.e. 'a' == 'a ' == 'a '.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant