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
dc779228
Commit
dc779228
authored
Nov 26, 2000
by
Tatsuo Ishii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for inserting/copying longer multibyte strings into bpchar data
types.
parent
ca1c7e66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varchar.c
+20
-2
No files found.
src/backend/utils/adt/varchar.c
View file @
dc779228
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.7
0 2000/11/21 21:16:02 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.7
1 2000/11/26 11:35:23 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -79,7 +79,17 @@ bpcharin(PG_FUNCTION_ARGS)
atttypmod
=
len
+
VARHDRSZ
;
}
else
#ifdef MULTIBYTE
{
/*
* truncate multi-byte string preserving multi-byte
* boundary
*/
len
=
pg_mbcliplen
(
s
,
atttypmod
-
VARHDRSZ
,
atttypmod
-
VARHDRSZ
);
}
#else
len
=
atttypmod
-
VARHDRSZ
;
#endif
result
=
(
BpChar
*
)
palloc
(
atttypmod
);
VARATT_SIZEP
(
result
)
=
atttypmod
;
...
...
@@ -96,7 +106,11 @@ bpcharin(PG_FUNCTION_ARGS)
#endif
/* blank pad the string if necessary */
#ifdef MULTIBYTE
for
(;
i
<
atttypmod
-
VARHDRSZ
;
i
++
)
#else
for
(;
i
<
len
;
i
++
)
#endif
*
r
++
=
' '
;
PG_RETURN_BPCHAR_P
(
result
);
...
...
@@ -329,7 +343,11 @@ varcharin(PG_FUNCTION_ARGS)
len
=
strlen
(
s
)
+
VARHDRSZ
;
if
(
atttypmod
>=
(
int32
)
VARHDRSZ
&&
len
>
atttypmod
)
#ifdef MULTIBYTE
len
=
pg_mbcliplen
(
s
,
len
-
VARHDRSZ
,
atttypmod
-
VARHDRSZ
)
+
VARHDRSZ
;
#else
len
=
atttypmod
;
/* clip the string at max length */
#endif
result
=
(
VarChar
*
)
palloc
(
len
);
VARATT_SIZEP
(
result
)
=
len
;
...
...
@@ -383,7 +401,7 @@ varchar(PG_FUNCTION_ARGS)
#ifdef MULTIBYTE
/*
* truncate multi-byte string
in a way not to break
multi-byte
* truncate multi-byte string
preserving
multi-byte
* boundary
*/
len
=
pg_mbcliplen
(
VARDATA
(
s
),
slen
-
VARHDRSZ
,
slen
-
VARHDRSZ
);
...
...
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