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

Dialect 1 casting date to string breaks when in the presence a domain with a check constraint [CORE4943] #5234

Closed
firebird-issue-importer opened this issue Sep 23, 2015 · 4 comments

Comments

@firebird-issue-importer

Submitted by: Steve Wiser (stevewiser)

If you run the script below it will generate 3 stored procedures to test this. Basically if you cast a date to a varchar in Dialect 1 it will return the date without the timestamp on it. However, once the stored procedure also includes a variable that is declared from a domain with a CHECK constraint on it the date casting will now include the timestamp. I am not sure why it exhibits different behaviors based on whether a variable is used with a domain that contains the check constraint. Removing the check constraint from the domain allows the date casting to not include the timestamp.

set term !! ;

create or alter procedure TEST_WORKS_AS_EXPECTED
returns (
retDate date,
retDateStr varchar(15),
retSuccess varchar(5))
AS
begin
retSuccess = 'True';

select cast('today' as date)
from rdb$database
into retDate;

retDateStr = cast(retDate as varchar(15));
end!!

create domain bool_flag as VARCHAR(5) CHARACTER SET NONE
CHECK (value is null or value in ('True', 'False'))
COLLATE NONE!!

create or alter procedure TEST_FAILS
returns (
retDate date,
retDateStr varchar(15),
retSuccess bool_flag)
AS
begin
retSuccess = 'True';

select cast('today' as date)
from rdb$database
into retDate;

retDateStr = cast(retDate as varchar(15));
end!!

create or alter procedure TEST_FAILS_FIXED
returns (
retDate date,
retDateStr varchar(50),
retSuccess bool_flag)
AS
begin
retSuccess = 'True';

select cast('today' as date)
from rdb$database
into retDate;

retDateStr = cast(retDate as varchar(50));
end!!

set term ; !!

Commits: fb89087 78f1402 FirebirdSQL/fbt-repository@584d2a9 FirebirdSQL/fbt-repository@741d346

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 23, 2015

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 24, 2015

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 RC 1 [ 10584 ]

Fix Version: 2.5.5 [ 10670 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 27, 2015

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 27, 2015

Modified by: @pavel-zotov

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants