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

lpad and rpad with two columns not working [CORE1346] #1765

Closed
firebird-issue-importer opened this issue Jul 5, 2007 · 19 comments
Closed

lpad and rpad with two columns not working [CORE1346] #1765

firebird-issue-importer opened this issue Jul 5, 2007 · 19 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2007

Submitted by: Robert Lakis (rlakis)

Is duplicated by CORE2597
Is related to QA242
Is duplicated by CORE1360

Check this:
select lpad('xxx', 8, '0') one, lpad('yyy', 8, '0') two from rdb$database

gives:
can't format message 13:796 -- message system code -4.
Dynamic SQL Error.
SQL error code = -204.
Implementation limit exceeded.
block size exceeds implementation restriction.

Commits: d2ec0ea 3915bcf

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2007

Commented by: @asfernandes

Unfortunatelly, this is as designed!
We don't support return strings of variable length, it needs a maximum size.

When you use two LPAD, another FB limit is reached.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2007

Commented by: Robert Lakis (rlakis)

this example is working:

select lpad('123', 8, '0') || ' string ' || lpad('1240', 8, '0') col from rdb$database

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2007

Commented by: @asfernandes

In theory, we can know the size, when it's constant.
But actually, this violates complete the layering, and is not supported with current code.

Workaround is to cast the result to a varchar of know size:
select cast(lpad('xxx', 8, '0') as varchar(8)) one, cast(lpad('yyy', 8, '0') as varchar(8)) two from rdb$database;

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 16, 2007

Modified by: @dyemanov

Link: This issue is duplicated by CORE1360 [ CORE1360 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 16, 2007

Commented by: @dyemanov

Adriano, should we consider SUBSTRING as also violating the layering? :-)

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 16, 2007

Commented by: @asfernandes

Here is what I've replied to Claudio:

> Hello, I read your explanation here
> CORE1346
> In theory, we can know the size, when it's constant.
> But actually, this violates complete the layering, and is not supported with
> current code.
>
> Won't substring violate the layering, too? It works with the size of the
> field. Initially, I made it to adjust the result to the length parameter,
> but this was against the standard.
And I supposed it was removed?

> However, I don't remember any technical
> problem to make it work with the field and the constant length. The problem
> was simply the logic was not in the SQL specification.
When things go to DataTypeUtil and SysFunction, we don't have access to the constant.
My idea when creating these files was to make code compatible with DSQL and JRD.

But the problem with PAD is that it can return strings with greater length than the original one, different from SUBSTRING.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 16, 2007

Modified by: @asfernandes

summary: lpad with two columns not working => lpad and rpad with two columns not working

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 16, 2007

Modified by: @asfernandes

Link: This issue block progress on CORE1360 [ CORE1360 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 26, 2007

Modified by: @pcisar

Link: This issue block progress on CORE1360 [ CORE1360 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 28, 2008

Modified by: @pcisar

Workflow: jira [ 12511 ] => Firebird [ 15217 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 5, 2009

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.5 RC1 [ 10300 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 2, 2009

Commented by: @asfernandes

Backported to 2.1.4.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 2, 2009

Modified by: @asfernandes

Version: 2.1.2 [ 10270 ]

Version: 2.1.1 [ 10223 ]

Version: 2.1.0 [ 10041 ]

Version: 2.1.3 [ 10302 ]

Fix Version: 2.1.4 [ 10361 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 2, 2009

Modified by: @asfernandes

Link: This issue is duplicated by CORE2597 [ CORE2597 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 16, 2009

Modified by: @pcisar

Link: This issue is related to QA242 [ QA242 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2011

Commented by: @pcisar

QA test added.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2011

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test => Done successfully

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