Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
607b2be7
Commit
607b2be7
authored
16 years ago
by
Peter Eisentraut
Browse files
Options
Downloads
Patches
Plain Diff
Additional string function tests for coverage of oracle_compat.c
parent
d5d552fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/regress/expected/strings.out
+143
-0
143 additions, 0 deletions
src/test/regress/expected/strings.out
src/test/regress/sql/strings.sql
+38
-0
38 additions, 0 deletions
src/test/regress/sql/strings.sql
with
181 additions
and
0 deletions
src/test/regress/expected/strings.out
+
143
−
0
View file @
607b2be7
...
...
@@ -1240,3 +1240,146 @@ select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, '
a\bcd | a\b'cd | a\b''cd | abcd\ | ab\'cd | \\
(1 row)
--
-- Additional string functions
--
SELECT initcap('hi THOMAS');
initcap
-----------
Hi Thomas
(1 row)
SELECT lpad('hi', 5, 'xy');
lpad
-------
xyxhi
(1 row)
SELECT lpad('hi', 5);
lpad
-------
hi
(1 row)
SELECT lpad('hi', -5, 'xy');
lpad
------
(1 row)
SELECT lpad('hello', 2);
lpad
------
he
(1 row)
SELECT lpad('hi', 5, '');
lpad
------
hi
(1 row)
SELECT rpad('hi', 5, 'xy');
rpad
-------
hixyx
(1 row)
SELECT rpad('hi', 5);
rpad
-------
hi
(1 row)
SELECT rpad('hi', -5, 'xy');
rpad
------
(1 row)
SELECT rpad('hello', 2);
rpad
------
he
(1 row)
SELECT rpad('hi', 5, '');
rpad
------
hi
(1 row)
SELECT ltrim('zzzytrim', 'xyz');
ltrim
-------
trim
(1 row)
SELECT translate('', '14', 'ax');
translate
-----------
(1 row)
SELECT translate('12345', '14', 'ax');
translate
-----------
a23x5
(1 row)
SELECT ascii('x');
ascii
-------
120
(1 row)
SELECT ascii('');
ascii
-------
0
(1 row)
SELECT chr(65);
chr
-----
A
(1 row)
SELECT chr(0);
ERROR: null character not permitted
SELECT repeat('Pg', 4);
repeat
----------
PgPgPgPg
(1 row)
SELECT repeat('Pg', -4);
repeat
--------
(1 row)
SELECT trim(E'\\000'::bytea from E'\\000Tom\\000'::bytea);
btrim
-------
Tom
(1 row)
SELECT btrim(E'\\000trim\\000'::bytea, E'\\000'::bytea);
btrim
-------
trim
(1 row)
SELECT btrim(''::bytea, E'\\000'::bytea);
btrim
-------
(1 row)
SELECT btrim(E'\\000trim\\000'::bytea, ''::bytea);
btrim
--------------
\000trim\000
(1 row)
This diff is collapsed.
Click to expand it.
src/test/regress/sql/strings.sql
+
38
−
0
View file @
607b2be7
...
...
@@ -450,3 +450,41 @@ select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\'
set standard_conforming_strings = off;
select '
a
\\
bcd
' as f1, '
a
\\
b
\
'cd'
as
f2
,
'a
\\
b
\'''
cd'
as
f3
,
'abcd
\\
'
as
f4
,
'ab
\\\'
cd'
as
f5
,
'
\\\\
'
as
f6
;
--
-- Additional string functions
--
SELECT
initcap
(
'hi THOMAS'
);
SELECT
lpad
(
'hi'
,
5
,
'xy'
);
SELECT
lpad
(
'hi'
,
5
);
SELECT
lpad
(
'hi'
,
-
5
,
'xy'
);
SELECT
lpad
(
'hello'
,
2
);
SELECT
lpad
(
'hi'
,
5
,
''
);
SELECT
rpad
(
'hi'
,
5
,
'xy'
);
SELECT
rpad
(
'hi'
,
5
);
SELECT
rpad
(
'hi'
,
-
5
,
'xy'
);
SELECT
rpad
(
'hello'
,
2
);
SELECT
rpad
(
'hi'
,
5
,
''
);
SELECT
ltrim
(
'zzzytrim'
,
'xyz'
);
SELECT
translate
(
''
,
'14'
,
'ax'
);
SELECT
translate
(
'12345'
,
'14'
,
'ax'
);
SELECT
ascii
(
'x'
);
SELECT
ascii
(
''
);
SELECT
chr
(
65
);
SELECT
chr
(
0
);
SELECT
repeat
(
'Pg'
,
4
);
SELECT
repeat
(
'Pg'
,
-
4
);
SELECT
trim
(
E
'
\\
000'
::
bytea
from
E
'
\\
000Tom
\\
000'
::
bytea
);
SELECT
btrim
(
E
'
\\
000trim
\\
000'
::
bytea
,
E
'
\\
000'
::
bytea
);
SELECT
btrim
(
''
::
bytea
,
E
'
\\
000'
::
bytea
);
SELECT
btrim
(
E
'
\\
000trim
\\
000'
::
bytea
,
''
::
bytea
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment