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
2e615931
Commit
2e615931
authored
Jun 05, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I made several adjustments to my earlier patch to handle the
condition where the target label is ambiguous.
parent
a576a60e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
16 deletions
+31
-16
src/backend/parser/parse_clause.c
src/backend/parser/parse_clause.c
+23
-8
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+4
-4
src/include/parser/parse_target.h
src/include/parser/parse_target.h
+3
-4
src/test/regress/sql/tests
src/test/regress/sql/tests
+1
-0
No files found.
src/backend/parser/parse_clause.c
View file @
2e615931
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.1
7 1998/05/29 14:00:19 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.1
8 1998/06/05 03:49:18 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -194,17 +194,32 @@ find_targetlist_entry(ParseState *pstate, SortGroupBy *sortgroupby, List *tlist)
...
@@ -194,17 +194,32 @@ find_targetlist_entry(ParseState *pstate, SortGroupBy *sortgroupby, List *tlist)
* it will not be projected into the final tuple.
* it will not be projected into the final tuple.
* daveh@insightdist.com 5/20/98
* daveh@insightdist.com 5/20/98
*/
*/
if
(
!
target_result
)
{
if
(
!
target_result
&&
sortgroupby
->
name
)
{
List
*
p_target
=
tlist
;
List
*
p_target
=
tlist
;
Ident
*
missingTargetId
=
(
Ident
*
)
makeNode
(
Ident
);
TargetEntry
*
tent
=
makeNode
(
TargetEntry
);
TargetEntry
*
tent
=
makeNode
(
TargetEntry
);
/* Fill in the constructed Ident node */
missingTargetId
->
type
=
T_Ident
;
missingTargetId
->
name
=
palloc
(
strlen
(
sortgroupby
->
name
)
+
1
);
strcpy
(
missingTargetId
->
name
,
sortgroupby
->
name
);
transformTargetId
(
pstate
,
missingTargetId
,
tent
,
missingTargetId
->
name
,
TRUE
);
if
(
sortgroupby
->
range
)
{
Attr
*
missingTarget
=
(
Attr
*
)
makeNode
(
Attr
);
missingTarget
->
type
=
T_Attr
;
missingTarget
->
relname
=
palloc
(
strlen
(
sortgroupby
->
range
)
+
1
);
strcpy
(
missingTarget
->
relname
,
sortgroupby
->
range
);
missingTarget
->
attrs
=
lcons
(
makeString
(
sortgroupby
->
name
),
NIL
);
transformTargetId
(
pstate
,
(
Node
*
)
missingTarget
,
tent
,
sortgroupby
->
name
,
TRUE
);
}
else
{
Ident
*
missingTarget
=
(
Ident
*
)
makeNode
(
Ident
);
missingTarget
->
type
=
T_Ident
;
missingTarget
->
name
=
palloc
(
strlen
(
sortgroupby
->
name
)
+
1
);
strcpy
(
missingTarget
->
name
,
sortgroupby
->
name
);
transformTargetId
(
pstate
,
(
Node
*
)
missingTarget
,
tent
,
sortgroupby
->
name
,
TRUE
);
}
/* Add to the end of the target list */
/* Add to the end of the target list */
while
(
lnext
(
p_target
)
!=
NIL
)
{
while
(
lnext
(
p_target
)
!=
NIL
)
{
...
...
src/backend/parser/parse_target.c
View file @
2e615931
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.1
4 1998/05/29 14:00:23 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.1
5 1998/06/05 03:49:18 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -54,7 +54,7 @@ size_target_expr(ParseState *pstate,
...
@@ -54,7 +54,7 @@ size_target_expr(ParseState *pstate,
*/
*/
void
void
transformTargetId
(
ParseState
*
pstate
,
transformTargetId
(
ParseState
*
pstate
,
Ident
*
ident
,
Node
*
node
,
TargetEntry
*
tent
,
TargetEntry
*
tent
,
char
*
resname
,
char
*
resname
,
int16
resjunk
)
int16
resjunk
)
...
@@ -68,7 +68,7 @@ transformTargetId(ParseState *pstate,
...
@@ -68,7 +68,7 @@ transformTargetId(ParseState *pstate,
* relation names (even though they can be stored in
* relation names (even though they can be stored in
* Ident nodes, too)
* Ident nodes, too)
*/
*/
expr
=
transform
Ident
(
pstate
,
(
Node
*
)
ident
,
EXPR_COLUMN_FIRST
);
expr
=
transform
Expr
(
pstate
,
node
,
EXPR_COLUMN_FIRST
);
type_id
=
exprType
(
expr
);
type_id
=
exprType
(
expr
);
if
(
nodeTag
(
expr
)
==
T_Var
)
if
(
nodeTag
(
expr
)
==
T_Var
)
type_mod
=
((
Var
*
)
expr
)
->
vartypmod
;
type_mod
=
((
Var
*
)
expr
)
->
vartypmod
;
...
@@ -113,7 +113,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
...
@@ -113,7 +113,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
identname
=
((
Ident
*
)
res
->
val
)
->
name
;
identname
=
((
Ident
*
)
res
->
val
)
->
name
;
handleTargetColname
(
pstate
,
&
res
->
name
,
NULL
,
identname
);
handleTargetColname
(
pstate
,
&
res
->
name
,
NULL
,
identname
);
resname
=
(
res
->
name
)
?
res
->
name
:
identname
;
resname
=
(
res
->
name
)
?
res
->
name
:
identname
;
transformTargetId
(
pstate
,
(
Ident
*
)
res
->
val
,
tent
,
resname
,
FALSE
);
transformTargetId
(
pstate
,
(
Node
*
)
res
->
val
,
tent
,
resname
,
FALSE
);
break
;
break
;
}
}
case
T_ParamNo
:
case
T_ParamNo
:
...
...
src/include/parser/parse_target.h
View file @
2e615931
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: parse_target.h,v 1.
6 1998/05/29 14:07:50 thomas
Exp $
* $Id: parse_target.h,v 1.
7 1998/06/05 03:49:19 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -24,9 +24,8 @@
...
@@ -24,9 +24,8 @@
extern
List
*
transformTargetList
(
ParseState
*
pstate
,
List
*
targetlist
);
extern
List
*
transformTargetList
(
ParseState
*
pstate
,
List
*
targetlist
);
extern
List
*
makeTargetNames
(
ParseState
*
pstate
,
List
*
cols
);
extern
List
*
makeTargetNames
(
ParseState
*
pstate
,
List
*
cols
);
extern
void
transformTargetId
(
ParseState
*
pstate
,
Ident
*
ident
,
extern
void
transformTargetId
(
ParseState
*
pstate
,
Node
*
node
,
TargetEntry
*
tent
,
char
*
resname
,
TargetEntry
*
tent
,
char
*
resname
,
int16
resjunk
);
int16
resjunk
);
extern
Node
*
coerce_target_expr
(
ParseState
*
pstate
,
Node
*
expr
,
extern
Node
*
coerce_target_expr
(
ParseState
*
pstate
,
Node
*
expr
,
Oid
type_id
,
Oid
attrtype
);
Oid
type_id
,
Oid
attrtype
);
...
...
src/test/regress/sql/tests
View file @
2e615931
...
@@ -58,3 +58,4 @@ hash_index
...
@@ -58,3 +58,4 @@ hash_index
select_views
select_views
alter_table
alter_table
portals_p2
portals_p2
junkfilter
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