diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-26 17:54:02 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-26 17:54:02 +0000 |
| commit | 5cabcfccce4b8b826c9b30828f3012b7926a6946 (patch) | |
| tree | 3e14c0710a45b4195734dd3189eb89eac4969073 /contrib/dblink/dblink.c | |
| parent | 8009c275925dda90f1275ba70f5c2a63abaa520b (diff) | |
| download | postgresql-5cabcfccce4b8b826c9b30828f3012b7926a6946.tar.gz | |
Modify array operations to include array's element type OID in the
array header, and to compute sizing and alignment of array elements
the same way normal tuple access operations do --- viz, using the
tupmacs.h macros att_addlength and att_align. This makes the world
safe for arrays of cstrings or intervals, and should make it much
easier to write array-type-polymorphic functions; as examples see
the cleanups of array_out and contrib/array_iterator. By Joe Conway
and Tom Lane.
Diffstat (limited to 'contrib/dblink/dblink.c')
| -rw-r--r-- | contrib/dblink/dblink.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index d396f070dd..0401e06f4f 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -502,6 +502,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS) /* * get array of pointers to c-strings from the input source array */ + Assert(ARR_ELEMTYPE(src_pkattvals_arry) == TEXTOID); src_pkattvals = (char **) palloc(src_nitems * sizeof(char *)); ptr = ARR_DATA_PTR(src_pkattvals_arry); for (i = 0; i < src_nitems; i++) @@ -527,6 +528,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS) /* * get array of pointers to c-strings from the input target array */ + Assert(ARR_ELEMTYPE(tgt_pkattvals_arry) == TEXTOID); tgt_pkattvals = (char **) palloc(tgt_nitems * sizeof(char *)); ptr = ARR_DATA_PTR(tgt_pkattvals_arry); for (i = 0; i < tgt_nitems; i++) @@ -621,6 +623,7 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS) /* * get array of pointers to c-strings from the input target array */ + Assert(ARR_ELEMTYPE(tgt_pkattvals_arry) == TEXTOID); tgt_pkattvals = (char **) palloc(tgt_nitems * sizeof(char *)); ptr = ARR_DATA_PTR(tgt_pkattvals_arry); for (i = 0; i < tgt_nitems; i++) @@ -725,6 +728,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS) /* * get array of pointers to c-strings from the input source array */ + Assert(ARR_ELEMTYPE(src_pkattvals_arry) == TEXTOID); src_pkattvals = (char **) palloc(src_nitems * sizeof(char *)); ptr = ARR_DATA_PTR(src_pkattvals_arry); for (i = 0; i < src_nitems; i++) @@ -750,6 +754,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS) /* * get array of pointers to c-strings from the input target array */ + Assert(ARR_ELEMTYPE(tgt_pkattvals_arry) == TEXTOID); tgt_pkattvals = (char **) palloc(tgt_nitems * sizeof(char *)); ptr = ARR_DATA_PTR(tgt_pkattvals_arry); for (i = 0; i < tgt_nitems; i++) |
