Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9432b6dd
Commit
9432b6dd
authored
25 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Do not assign output columns to junk attributes created from
GROUP BY or ORDER BY expressions in INSERT ... SELECT.
parent
505b5185
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/parser/parse_target.c
+11
-10
11 additions, 10 deletions
src/backend/parser/parse_target.c
with
11 additions
and
10 deletions
src/backend/parser/parse_target.c
+
11
−
10
View file @
9432b6dd
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.3
8
1999/05/2
2 04:12:28 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.3
9
1999/05/2
3 21:42:09 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -32,16 +32,12 @@
...
@@ -32,16 +32,12 @@
static
List
*
ExpandAllTables
(
ParseState
*
pstate
);
static
List
*
ExpandAllTables
(
ParseState
*
pstate
);
char
*
FigureColname
(
Node
*
expr
,
Node
*
resval
);
static
char
*
FigureColname
(
Node
*
expr
,
Node
*
resval
);
static
Node
*
SizeTargetExpr
(
ParseState
*
pstate
,
static
Node
*
SizeTargetExpr
(
ParseState
*
pstate
,
Node
*
expr
,
Node
*
expr
,
Oid
attrtype
,
Oid
attrtype
,
int32
attrtypmod
);
int32
attrtypmod
);
static
TargetEntry
*
MakeTargetEntryCase
(
ParseState
*
pstate
,
ResTarget
*
res
);
/* MakeTargetEntryIdent()
/* MakeTargetEntryIdent()
* Transforms an Ident Node to a Target Entry
* Transforms an Ident Node to a Target Entry
...
@@ -66,8 +62,13 @@ MakeTargetEntryIdent(ParseState *pstate,
...
@@ -66,8 +62,13 @@ MakeTargetEntryIdent(ParseState *pstate,
Oid
attrtype_target
;
Oid
attrtype_target
;
TargetEntry
*
tent
=
makeNode
(
TargetEntry
);
TargetEntry
*
tent
=
makeNode
(
TargetEntry
);
if
(
pstate
->
p_is_insert
)
if
(
pstate
->
p_is_insert
&&
!
resjunk
)
{
{
/* Assign column name of destination column to the new TLE.
* XXX this is probably WRONG in INSERT ... SELECT case,
* since handling of GROUP BY and so forth probably should use
* the source table's names not the destination's names.
*/
if
(
pstate
->
p_insert_columns
!=
NIL
)
if
(
pstate
->
p_insert_columns
!=
NIL
)
{
{
Ident
*
id
=
lfirst
(
pstate
->
p_insert_columns
);
Ident
*
id
=
lfirst
(
pstate
->
p_insert_columns
);
...
@@ -79,7 +80,7 @@ MakeTargetEntryIdent(ParseState *pstate,
...
@@ -79,7 +80,7 @@ MakeTargetEntryIdent(ParseState *pstate,
elog
(
ERROR
,
"INSERT has more expressions than target columns"
);
elog
(
ERROR
,
"INSERT has more expressions than target columns"
);
}
}
if
(
pstate
->
p_is_insert
||
pstate
->
p_is_update
)
if
(
(
pstate
->
p_is_insert
||
pstate
->
p_is_update
)
&&
!
resjunk
)
{
{
Oid
attrtype_id
;
Oid
attrtype_id
;
int
resdomno_id
,
int
resdomno_id
,
...
@@ -208,7 +209,7 @@ MakeTargetEntryExpr(ParseState *pstate,
...
@@ -208,7 +209,7 @@ MakeTargetEntryExpr(ParseState *pstate,
type_mod
=
-
1
;
type_mod
=
-
1
;
/* Process target columns that will be receiving results */
/* Process target columns that will be receiving results */
if
(
pstate
->
p_is_insert
||
pstate
->
p_is_update
)
if
(
(
pstate
->
p_is_insert
||
pstate
->
p_is_update
)
&&
!
resjunk
)
{
{
/*
/*
...
@@ -870,7 +871,7 @@ ExpandAllTables(ParseState *pstate)
...
@@ -870,7 +871,7 @@ ExpandAllTables(ParseState *pstate)
* list, we have to guess.
* list, we have to guess.
*
*
*/
*/
char
*
static
char
*
FigureColname
(
Node
*
expr
,
Node
*
resval
)
FigureColname
(
Node
*
expr
,
Node
*
resval
)
{
{
switch
(
nodeTag
(
expr
))
switch
(
nodeTag
(
expr
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment