Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5c36a5d

Browse files
committed
Merge branch 'hotfix-101'
2 parentse9101cd +4a62110 commit5c36a5d

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

‎src/compat/pg_compat.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include"optimizer/prep.h"
2525
#include"parser/parse_utilcmd.h"
2626
#include"port.h"
27+
#include"utils/builtins.h"
2728
#include"utils/lsyscache.h"
2829
#include"utils/syscache.h"
2930

@@ -520,6 +521,73 @@ get_rel_persistence(Oid relid)
520521
#endif
521522

522523

524+
#if (PG_VERSION_NUM >=90500&&PG_VERSION_NUM <=90505)|| \
525+
(PG_VERSION_NUM >=90600&&PG_VERSION_NUM <=90601)
526+
/*
527+
* Return a palloc'd bare attribute map for tuple conversion, matching input
528+
* and output columns by name. (Dropped columns are ignored in both input and
529+
* output.) This is normally a subroutine for convert_tuples_by_name, but can
530+
* be used standalone.
531+
*/
532+
AttrNumber*
533+
convert_tuples_by_name_map(TupleDescindesc,
534+
TupleDescoutdesc,
535+
constchar*msg)
536+
{
537+
AttrNumber*attrMap;
538+
intn;
539+
inti;
540+
541+
n=outdesc->natts;
542+
attrMap= (AttrNumber*)palloc0(n*sizeof(AttrNumber));
543+
for (i=0;i<n;i++)
544+
{
545+
Form_pg_attributeatt=outdesc->attrs[i];
546+
char*attname;
547+
Oidatttypid;
548+
int32atttypmod;
549+
intj;
550+
551+
if (att->attisdropped)
552+
continue;/* attrMap[i] is already 0 */
553+
attname=NameStr(att->attname);
554+
atttypid=att->atttypid;
555+
atttypmod=att->atttypmod;
556+
for (j=0;j<indesc->natts;j++)
557+
{
558+
att=indesc->attrs[j];
559+
if (att->attisdropped)
560+
continue;
561+
if (strcmp(attname,NameStr(att->attname))==0)
562+
{
563+
/* Found it, check type */
564+
if (atttypid!=att->atttypid||atttypmod!=att->atttypmod)
565+
ereport(ERROR,
566+
(errcode(ERRCODE_DATATYPE_MISMATCH),
567+
errmsg_internal("%s",_(msg)),
568+
errdetail("Attribute \"%s\" of type %s does not match corresponding attribute of type %s.",
569+
attname,
570+
format_type_be(outdesc->tdtypeid),
571+
format_type_be(indesc->tdtypeid))));
572+
attrMap[i]= (AttrNumber) (j+1);
573+
break;
574+
}
575+
}
576+
if (attrMap[i]==0)
577+
ereport(ERROR,
578+
(errcode(ERRCODE_DATATYPE_MISMATCH),
579+
errmsg_internal("%s",_(msg)),
580+
errdetail("Attribute \"%s\" of type %s does not exist in type %s.",
581+
attname,
582+
format_type_be(outdesc->tdtypeid),
583+
format_type_be(indesc->tdtypeid))));
584+
}
585+
586+
returnattrMap;
587+
}
588+
#endif
589+
590+
523591

524592
/*
525593
* -------------

‎src/include/compat/pg_compat.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,20 @@ extern void set_rel_consider_parallel(PlannerInfo *root,
549549
#endif
550550

551551

552+
/*
553+
* convert_tuples_by_name_map()
554+
*/
555+
#if (PG_VERSION_NUM >=90500&&PG_VERSION_NUM <=90505)|| \
556+
(PG_VERSION_NUM >=90600&&PG_VERSION_NUM <=90601)
557+
externAttrNumber*convert_tuples_by_name_map(TupleDescindesc,
558+
TupleDescoutdesc,
559+
constchar*msg);
560+
#else
561+
#include"access/tupconvert.h"
562+
#endif
563+
564+
565+
552566
/*
553567
* -------------
554568
* Common code

‎src/pl_funcs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include"xact_handling.h"
1919
#include"utils.h"
2020

21-
#include"access/tupconvert.h"
2221
#include"access/htup_details.h"
2322
#include"catalog/dependency.h"
2423
#include"catalog/indexing.h"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp