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
c99f8200
Commit
c99f8200
authored
Sep 23, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak dblink functions to use int4 arguments instead of int2,
to avoid having to write explicit casts. From Joe Conway.
parent
245b3d7d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
contrib/dblink/dblink.c
contrib/dblink/dblink.c
+24
-6
contrib/dblink/dblink.sql.in
contrib/dblink/dblink.sql.in
+6
-6
No files found.
contrib/dblink/dblink.c
View file @
c99f8200
...
...
@@ -1002,6 +1002,9 @@ dblink_last_oid(PG_FUNCTION_ARGS)
}
#ifndef SHRT_MAX
#define SHRT_MAX (0x7FFF)
#endif
/*
* dblink_build_sql_insert
*
...
...
@@ -1028,7 +1031,8 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
Oid
relid
;
text
*
relname_text
;
int16
*
pkattnums
;
int16
pknumatts
;
int
pknumatts_tmp
;
int16
pknumatts
=
0
;
char
**
src_pkattvals
;
char
**
tgt_pkattvals
;
ArrayType
*
src_pkattvals_arry
;
...
...
@@ -1057,7 +1061,11 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
elog
(
ERROR
,
"dblink_build_sql_insert: relation does not exist"
);
pkattnums
=
(
int16
*
)
PG_GETARG_POINTER
(
1
);
pknumatts
=
PG_GETARG_INT16
(
2
);
pknumatts_tmp
=
PG_GETARG_INT32
(
2
);
if
(
pknumatts_tmp
<=
SHRT_MAX
)
pknumatts
=
pknumatts_tmp
;
else
elog
(
ERROR
,
"Bad input value for pknumatts; too large"
);
/*
* There should be at least one key attribute
...
...
@@ -1167,7 +1175,8 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
Oid
relid
;
text
*
relname_text
;
int16
*
pkattnums
;
int16
pknumatts
;
int
pknumatts_tmp
;
int16
pknumatts
=
0
;
char
**
tgt_pkattvals
;
ArrayType
*
tgt_pkattvals_arry
;
int
tgt_ndim
;
...
...
@@ -1191,7 +1200,11 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
elog
(
ERROR
,
"dblink_build_sql_delete: relation does not exist"
);
pkattnums
=
(
int16
*
)
PG_GETARG_POINTER
(
1
);
pknumatts
=
PG_GETARG_INT16
(
2
);
pknumatts_tmp
=
PG_GETARG_INT32
(
2
);
if
(
pknumatts_tmp
<=
SHRT_MAX
)
pknumatts
=
pknumatts_tmp
;
else
elog
(
ERROR
,
"Bad input value for pknumatts; too large"
);
/*
* There should be at least one key attribute
...
...
@@ -1274,7 +1287,8 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
Oid
relid
;
text
*
relname_text
;
int16
*
pkattnums
;
int16
pknumatts
;
int
pknumatts_tmp
;
int16
pknumatts
=
0
;
char
**
src_pkattvals
;
char
**
tgt_pkattvals
;
ArrayType
*
src_pkattvals_arry
;
...
...
@@ -1303,7 +1317,11 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
elog
(
ERROR
,
"dblink_build_sql_update: relation does not exist"
);
pkattnums
=
(
int16
*
)
PG_GETARG_POINTER
(
1
);
pknumatts
=
PG_GETARG_INT16
(
2
);
pknumatts_tmp
=
PG_GETARG_INT32
(
2
);
if
(
pknumatts_tmp
<=
SHRT_MAX
)
pknumatts
=
pknumatts_tmp
;
else
elog
(
ERROR
,
"Bad input value for pknumatts; too large"
);
/*
* There should be one source array key values for each key attnum
...
...
contrib/dblink/dblink.sql.in
View file @
c99f8200
...
...
@@ -57,15 +57,15 @@ CREATE OR REPLACE FUNCTION dblink_get_pkey (text) RETURNS setof dblink_pkey_resu
AS 'MODULE_PATHNAME','dblink_get_pkey' LANGUAGE 'c'
WITH (isstrict);
CREATE OR REPLACE FUNCTION dblink_build_sql_insert (text, int2vector, int
2
, _text, _text) RETURNS text
CREATE OR REPLACE FUNCTION dblink_build_sql_insert (text, int2vector, int
4
, _text, _text) RETURNS text
AS 'MODULE_PATHNAME','dblink_build_sql_insert' LANGUAGE 'c'
WITH (isstrict);
CREATE OR REPLACE FUNCTION dblink_build_sql_delete (text, int2vector, int
2
, _text) RETURNS text
CREATE OR REPLACE FUNCTION dblink_build_sql_delete (text, int2vector, int
4
, _text) RETURNS text
AS 'MODULE_PATHNAME','dblink_build_sql_delete' LANGUAGE 'c'
WITH (isstrict);
CREATE OR REPLACE FUNCTION dblink_build_sql_update (text, int2vector, int
2
, _text, _text) RETURNS text
CREATE OR REPLACE FUNCTION dblink_build_sql_update (text, int2vector, int
4
, _text, _text) RETURNS text
AS 'MODULE_PATHNAME','dblink_build_sql_update' LANGUAGE 'c'
WITH (isstrict);
...
...
@@ -82,8 +82,8 @@ GRANT EXECUTE ON FUNCTION dblink (text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_exec (text,text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_exec (text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_get_pkey (text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_build_sql_insert (text, int2vector, int
2
, _text, _text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_build_sql_delete (text, int2vector, int
2
, _text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_build_sql_update (text, int2vector, int
2
, _text, _text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_build_sql_insert (text, int2vector, int
4
, _text, _text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_build_sql_delete (text, int2vector, int
4
, _text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_build_sql_update (text, int2vector, int
4
, _text, _text) TO PUBLIC;
GRANT EXECUTE ON FUNCTION dblink_current_query () TO PUBLIC;
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