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

Commitd394d06

Browse files
committed
Fix atttypmod alignment again, and re-enable ecpg.
1 parente2b0911 commitd394d06

File tree

6 files changed

+43
-26
lines changed

6 files changed

+43
-26
lines changed

‎src/backend/commands/defind.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.23 1998/08/2605:22:36 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.24 1998/08/2616:43:41 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -468,7 +468,7 @@ NormIndexAttrs(List *attList,/* list of IndexElem's */
468468
OidrelId)
469469
{
470470
List*rest;
471-
HeapTupletuple;
471+
HeapTupleatttuple,tuple;
472472

473473
/*
474474
* process attributeList
@@ -484,20 +484,34 @@ NormIndexAttrs(List *attList,/* list of IndexElem's */
484484
if (attribute->name==NULL)
485485
elog(ERROR,"missing attribute for define index");
486486

487-
tuple=SearchSysCacheTuple(ATTNAME,
487+
atttuple=SearchSysCacheTupleCopy(ATTNAME,
488488
ObjectIdGetDatum(relId),
489489
PointerGetDatum(attribute->name),
490490
0,0);
491-
if (!HeapTupleIsValid(tuple))
491+
if (!HeapTupleIsValid(atttuple))
492492
{
493493
elog(ERROR,
494494
"DefineIndex: attribute \"%s\" not found",
495495
attribute->name);
496496
}
497497

498-
attform= (AttributeTupleForm)GETSTRUCT(tuple);
498+
attform= (AttributeTupleForm)GETSTRUCT(atttuple);
499499
*attNumP++=attform->attnum;
500500

501+
/* we want the type so we can set the proper alignment, etc. */
502+
if (attribute->typename==NULL)
503+
{
504+
tuple=SearchSysCacheTuple(TYPOID,
505+
ObjectIdGetDatum(attform->atttypid),
506+
0,0,0);
507+
if (!HeapTupleIsValid(tuple))
508+
elog(ERROR,"create index: type for attribute '%s' undefined",
509+
attribute->name);
510+
/* we just set the type name because that is all we need */
511+
attribute->typename=makeNode(TypeName);
512+
attribute->typename->name=nameout(&((TypeTupleForm)GETSTRUCT(tuple))->typname);
513+
}
514+
501515
if (attribute->class==NULL)
502516
{
503517
/* no operator class specified, so find the default */
@@ -520,21 +534,7 @@ NormIndexAttrs(List *attList,/* list of IndexElem's */
520534
attribute->class);
521535
}
522536
*classOidP++=tuple->t_oid;
523-
/* we want the type so we can set the proper alignment, etc. */
524-
if (attribute->typename==NULL)
525-
{
526-
Oidtypoid= ((Form_pg_opclass)GETSTRUCT(tuple))->opcdeftype;
527-
528-
tuple=SearchSysCacheTuple(TYPOID,
529-
ObjectIdGetDatum(typoid),
530-
0,0,0);
531-
if (!HeapTupleIsValid(tuple))
532-
elog(ERROR,"create index: type for class '%s' undefined",
533-
attribute->class);
534-
/* we just set the name because that is all we need */
535-
attribute->typename=makeNode(TypeName);
536-
attribute->typename->name=nameout(&((TypeTupleForm)GETSTRUCT(tuple))->typname);
537-
}
537+
pfree(atttuple);
538538
}
539539
}
540540

‎src/backend/parser/gram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
*
222222
*
223223
* IDENTIFICATION
224-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.30 1998/08/2605:22:43 momjian Exp $
224+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.31 1998/08/2616:43:43 momjian Exp $
225225
*
226226
* HISTORY
227227
* AUTHORDATEMAJOR EVENT

‎src/include/catalog/pg_attribute.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_attribute.h,v 1.37 1998/08/2605:51:24 momjian Exp $
10+
* $Id: pg_attribute.h,v 1.38 1998/08/2616:43:48 momjian Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -339,7 +339,7 @@ DATA(insert OID = 0 ( 1249 attlen21 0 2 5 0 -1 -1 t f s f f));
339339
DATA(insertOID=0 (1249attnum210260-1-1tfsff));
340340
DATA(insertOID=0 (1249attnelems230470-1-1tfiff));
341341
DATA(insertOID=0 (1249attcacheoff230480-1-1tfiff));
342-
DATA(insertOID=0 (1249atttypmod210490-1-1tfsff));
342+
DATA(insertOID=0 (1249atttypmod230490-1-1tfiff));
343343
DATA(insertOID=0 (1249attbyval1601100-1-1tfcff));
344344
DATA(insertOID=0 (1249attisset1601110-1-1tfcff));
345345
DATA(insertOID=0 (1249attalign1801120-1-1tfcff));
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- This makes sure the pg_attribute columns match the type's columns
2+
-- bjm 1998/08/26
3+
4+
-- check lengths
5+
SELECTpg_attribute.oid, relname, attname
6+
FROMpg_class, pg_attribute, pg_type
7+
WHEREpg_class.oid= attrelidAND
8+
atttypid=pg_type.oidAND
9+
attlen!= typlen;
10+
11+
-- check alignment
12+
SELECTpg_attribute.oid, relname, attname
13+
FROMpg_class, pg_attribute, pg_type
14+
WHEREpg_class.oid= attrelidAND
15+
atttypid=pg_type.oidAND
16+
attalign!= typalign;
17+

‎src/interfaces/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.14 1998/08/2605:22:58 momjian Exp $
10+
# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.15 1998/08/2616:43:51 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -23,7 +23,7 @@ endif
2323

2424
.DEFAULTallinstallcleandepdependdistclean:$(perl-makefile-dep)
2525
$(MAKE) -C libpq$@
26-
#$(MAKE) -C ecpg $@
26+
$(MAKE) -C ecpg$@
2727
ifeq ($(HAVE_Cplusplus), true)
2828
$(MAKE) -C libpq++ $@
2929
else

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ output_statement(char * stmt, int mode)
641641
%type<str>join_usingwhere_clauserelation_exprrow_opsub_type
642642
%type<str>opt_column_listinsert_restInsertStmtOptimizableStmt
643643
%type<str>columnListDeleteStmtLockStmtUpdateStmtCursorStmt
644-
%type<str>NotifyStmtcolumnElemcopy_dirnSubUnionc_expr
644+
%type<str>NotifyStmtcolumnElemcopy_dirnSubUnionc_exprUnlistenStmt
645645
%type<str>copy_delimiterListenStmtCopyStmtcopy_file_nameopt_binary
646646
%type<str>opt_with_copyFetchStmtopt_directionfetch_how_manyopt_portal_name
647647
%type<str>ClosePortalStmtDestroyStmtVacuumStmtopt_verbose

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp