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
dab708ea
Commit
dab708ea
authored
23 years ago
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cause transformIndexConstraints() to do the right thing with requests
for indexes on system columns. Per complaint from Peter.
parent
c59839ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+21
-1
No files found.
src/backend/parser/analyze.c
View file @
dab708ea
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.20
1 2001/10/12 00:07:14
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.20
2 2001/10/22 22:49:02
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -15,6 +15,7 @@
#include "access/heapam.h"
#include "catalog/catname.h"
#include "catalog/heap.h"
#include "catalog/pg_index.h"
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
...
...
@@ -50,6 +51,7 @@ typedef struct
char
*
relname
;
/* name of relation */
List
*
inhRelnames
;
/* names of relations to inherit from */
bool
istemp
;
/* is it to be a temp relation? */
bool
hasoids
;
/* does relation have an OID column? */
Oid
relOid
;
/* OID of table, if ALTER TABLE case */
List
*
columns
;
/* ColumnDef items */
List
*
ckconstraints
;
/* CHECK constraints */
...
...
@@ -720,6 +722,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
cxt
.
relname
=
stmt
->
relname
;
cxt
.
inhRelnames
=
stmt
->
inhRelnames
;
cxt
.
istemp
=
stmt
->
istemp
;
cxt
.
hasoids
=
stmt
->
hasoids
;
cxt
.
relOid
=
InvalidOid
;
cxt
.
columns
=
NIL
;
cxt
.
ckconstraints
=
NIL
;
...
...
@@ -1106,6 +1109,15 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
if
(
constraint
->
contype
==
CONSTR_PRIMARY
)
column
->
is_not_null
=
TRUE
;
}
else
if
(
SystemAttributeByName
(
key
->
name
,
cxt
->
hasoids
)
!=
NULL
)
{
/*
* column will be a system column in the new table,
* so accept it. System columns can't ever be null,
* so no need to worry about PRIMARY/NOT NULL constraint.
*/
found
=
true
;
}
else
if
(
cxt
->
inhRelnames
)
{
/* try inherited tables */
...
...
@@ -2520,6 +2532,10 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
cxt
.
relOid
=
GetSysCacheOid
(
RELNAME
,
PointerGetDatum
(
stmt
->
relname
),
0
,
0
,
0
);
cxt
.
hasoids
=
SearchSysCacheExists
(
ATTNUM
,
ObjectIdGetDatum
(
cxt
.
relOid
),
Int16GetDatum
(
ObjectIdAttributeNumber
),
0
,
0
);
cxt
.
columns
=
NIL
;
cxt
.
ckconstraints
=
NIL
;
cxt
.
fkconstraints
=
NIL
;
...
...
@@ -2548,6 +2564,10 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
cxt
.
relOid
=
GetSysCacheOid
(
RELNAME
,
PointerGetDatum
(
stmt
->
relname
),
0
,
0
,
0
);
cxt
.
hasoids
=
SearchSysCacheExists
(
ATTNUM
,
ObjectIdGetDatum
(
cxt
.
relOid
),
Int16GetDatum
(
ObjectIdAttributeNumber
),
0
,
0
);
cxt
.
columns
=
NIL
;
cxt
.
ckconstraints
=
NIL
;
cxt
.
fkconstraints
=
NIL
;
...
...
This diff is collapsed.
Click to expand it.
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