Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
607b2be7
Commit
607b2be7
authored
Oct 04, 2008
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional string function tests for coverage of oracle_compat.c
parent
d5d552fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
181 additions
and
0 deletions
+181
-0
src/test/regress/expected/strings.out
src/test/regress/expected/strings.out
+143
-0
src/test/regress/sql/strings.sql
src/test/regress/sql/strings.sql
+38
-0
No files found.
src/test/regress/expected/strings.out
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)
src/test/regress/sql/strings.sql
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
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment