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
Built-in string manipulation, by position, function [CORE5997] #6247
Comments
Commented by: @asfernandes That seems as a completelly different thing than SQL strings, which are immutable. I don't remember any DBMS doing that too. |
Commented by: @livius2 I do not know what SQL string is. I am talking about PSQL variable of type VARCHAR or CHAR. Without this, writing string function operated on chars in PSQL is not efficient at all. Try write efficient function to generate e.g. camel style string from "string" parameter. |
Commented by: @asfernandes > to any char in this varable as i have in "any" programing language Show me examples in PLSQL, T-SQL, PG/PL SQL, please. You don't have S[N] = S in any programming language that have immutable string. You don't have even read S[N] in Java. |
Commented by: @asfernandes For SUBSTRING + concat + SUBSTRING, use OVERLAY function. |
Commented by: @livius2 This is e.g. slow compared to udf equivalent SET TERM ^ ; SELECT UP_FIRST_STR('Lorem ipsum dolor sit amet') FROM RDB$DATABASE --------------------------------------------------------------------------------------------- i need to be possible something like this SET TERM ^ ; maybe will be also possible to remove the need to have VAR_RESULT at all ------------------------------------------- >> You don't have S[N] = S in any programming language that have immutable string. >> You don't have even read S[N] in Java. |
Commented by: Sean Leyne (seanleyne) Karol, So you are asking for "new built-in string manipulation, by position, function"? |
Commented by: @livius2 Yes, efficient and simple to use string manipulation without need to new allocation of string and need to use substring at all. Same as is in Delphi. P.s. |
Commented by: Sean Leyne (seanleyne) Edit to the ticket summary, was "Add simple indexed(positioned) operations on strings (varchar, char) in Triggers, Procedures, functions" |
Modified by: Sean Leyne (seanleyne)summary: Add simple indexed(positioned) operations on strings (varchar, char) in Triggers, Procedures, functions => Built-in string manipulation, by position, function |
Commented by: Sean Leyne (seanleyne) Performance comparison of new built-in functions/psql vs. UDF should be discussed on support/devel mailing lists, not here. |
Commented by: @asfernandes Mutable strings are a major architecture change that should be discussed in devel list, and I doubt it would be implemented, so closing ticket. And SUBSTRING is already the standard function to read a string portion. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Commented by: Sean Leyne (seanleyne) I do not agree that this ticket should be closed. At least, not without larger discussion. There are plenty of tickets for features/improvements that are of questionable value/implementation, that doesn't mean they should be closed. |
Commented by: @asfernandes Then reopen it. "There are plenty of tickets" that the developer feel it's inappropriate and close it (as I did here), and "there are plenty of tickets" that will never be done and are forever open until someone found and does a cleanup. That second group, unfortunately, seems for me much larger than the first. |
Modified by: @livius2description: Please implement simple operations on strings in stored procedures, triggers, functions.. i mean: s[5] = 'A'; xxx = s[5] + s[3] + s[1]; instead of "[]" there can be different bracket e.g. "{}" if it collide somehow with array fields => Please implement simple operations on strings in stored procedures, triggers, functions.. i mean: s[5] = 'A'; xxx = s[5] + s[3] + s[1]; instead of "[]" there can be different bracket e.g. "{}" if it collide somehow with array fields Compare simplification: Vs VAR_S = SUBSTRING(VAR_A FROM 5 FOR 1) || SUBSTRING(VAR_A FROM 3 FOR 1) || SUBSTRING(VAR_A FROM 1 FOR 1); -------------------------------------------------------------------------------------- Or better sample VAR_S[5] = VAR_A[3]; Vs VAR_S = SUBSTRING(VAR_S FROM 1 FOR 2) || SUBSTRING(VAR_A FROM 5 FOR 1) || SUBSTRING(VAR_S FROM 4 FOR 1) || SUBSTRING(VAR_A FROM 3 FOR 1) || SUBSTRING(VAR_S FROM 6); |
Submitted by: @livius2
Please implement simple operations on strings in stored procedures, triggers, functions..
i mean:
s[5] = 'A';
s[5] = s[6];
xxx = s[5] + s[3] + s[1];
instead of "[]" there can be different bracket e.g. "{}" if it collide somehow with array fields
Compare simplification:
--------------------------------------------------------------------------------------
VAR_S = VAR_A[5] || VAR_A[3] || VAR_A[1];
Vs
VAR_S = SUBSTRING(VAR_A FROM 5 FOR 1) || SUBSTRING(VAR_A FROM 3 FOR 1) || SUBSTRING(VAR_A FROM 1 FOR 1);
--------------------------------------------------------------------------------------
Or better sample
VAR_S[5] = VAR_A[3];
VAR_S[3] = VAR_A[5];
Vs
VAR_S = SUBSTRING(VAR_S FROM 1 FOR 2) || SUBSTRING(VAR_A FROM 5 FOR 1) || SUBSTRING(VAR_S FROM 4 FOR 1) || SUBSTRING(VAR_A FROM 3 FOR 1) || SUBSTRING(VAR_S FROM 6);
The text was updated successfully, but these errors were encountered: