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
4a9c2390
Commit
4a9c2390
authored
26 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Fix brain death in !!= operator ... it's still pretty bogus
but at least now it does what it's supposed to do ...
parent
265c283e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backend/utils/adt/not_in.c
+30
-23
30 additions, 23 deletions
src/backend/utils/adt/not_in.c
src/include/utils/builtins.h
+2
-2
2 additions, 2 deletions
src/include/utils/builtins.h
with
32 additions
and
25 deletions
src/backend/utils/adt/not_in.c
+
30
−
23
View file @
4a9c2390
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.1
4
1999/0
2
/1
3 23:19:26 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.1
5
1999/0
3
/1
5 03:24:32 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -36,11 +36,10 @@ static int my_varattno(Relation rd, char *a);
...
@@ -36,11 +36,10 @@ static int my_varattno(Relation rd, char *a);
* ----------------------------------------------------------------
* ----------------------------------------------------------------
*/
*/
bool
bool
int4notin
(
int
16
not_in_arg
,
char
*
relation_and_attr
)
int4notin
(
int
32
not_in_arg
,
char
*
relation_and_attr
)
{
{
Relation
relation_to_scan
;
Relation
relation_to_scan
;
int
left_side_argument
,
int32
integer_value
;
integer_value
;
HeapTuple
current_tuple
;
HeapTuple
current_tuple
;
HeapScanDesc
scan_descriptor
;
HeapScanDesc
scan_descriptor
;
bool
dummy
,
bool
dummy
,
...
@@ -48,47 +47,55 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
...
@@ -48,47 +47,55 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
int
attrid
;
int
attrid
;
char
*
relation
,
char
*
relation
,
*
attribute
;
*
attribute
;
char
my_copy
[
3
2
];
char
my_copy
[
NAMEDATALEN
*
2
+
2
];
Datum
value
;
Datum
value
;
NameData
relNameData
;
ScanKeyData
skeyData
;
strcpy
(
my_copy
,
relation_and_attr
);
strncpy
(
my_copy
,
relation_and_attr
,
sizeof
(
my_copy
));
my_copy
[
sizeof
(
my_copy
)
-
1
]
=
'\0'
;
relation
=
(
char
*
)
strtok
(
my_copy
,
"."
);
relation
=
(
char
*
)
strtok
(
my_copy
,
"."
);
attribute
=
(
char
*
)
strtok
(
NULL
,
"."
);
attribute
=
(
char
*
)
strtok
(
NULL
,
"."
);
if
(
attribute
==
NULL
)
{
elog
(
ERROR
,
"int4notin: must provide relationname.attributename"
);
}
/* Open the relation and get a relation descriptor */
/* fetch tuple OID */
relation_to_scan
=
heap_openr
(
relation
);
if
(
!
RelationIsValid
(
relation_to_scan
))
left_side_argument
=
not_in_arg
;
{
elog
(
ERROR
,
"int4notin: unknown relation %s"
,
relation
);
}
/*
Open
the
relation and get a relation descriptor
*/
/*
Find
the
column to search
*/
namestrcpy
(
&
relNameData
,
relation
);
relation_to_scan
=
heap_openr
(
relNameData
.
data
);
attrid
=
my_varattno
(
relation_to_scan
,
attribute
);
attrid
=
my_varattno
(
relation_to_scan
,
attribute
);
if
(
attrid
<
0
)
{
elog
(
ERROR
,
"int4notin: unknown attribute %s for relation %s"
,
attribute
,
relation
);
}
/* the last argument should be a ScanKey, not an integer! - jolly */
/* it looks like the arguments are out of order, too */
/* but skeyData is never initialized! does this work?? - ay 2/95 */
scan_descriptor
=
heap_beginscan
(
relation_to_scan
,
false
,
SnapshotNow
,
scan_descriptor
=
heap_beginscan
(
relation_to_scan
,
false
,
SnapshotNow
,
0
,
&
skeyData
);
0
,
(
ScanKey
)
NULL
);
retval
=
true
;
retval
=
true
;
/* do a scan of the relation, and do the check */
/* do a scan of the relation, and do the check */
while
(
HeapTupleIsValid
(
current_tuple
=
heap_getnext
(
scan_descriptor
,
0
))
&&
while
(
HeapTupleIsValid
(
current_tuple
=
heap_getnext
(
scan_descriptor
,
0
)))
retval
)
{
{
value
=
heap_getattr
(
current_tuple
,
value
=
heap_getattr
(
current_tuple
,
(
AttrNumber
)
attrid
,
(
AttrNumber
)
attrid
,
RelationGetDescr
(
relation_to_scan
),
RelationGetDescr
(
relation_to_scan
),
&
dummy
);
&
dummy
);
integer_value
=
DatumGetInt32
(
value
);
i
nteger_value
=
DatumGetInt16
(
value
)
;
i
f
(
not_in_arg
==
integer_
value
)
if
(
left_side_argument
==
integer_value
)
{
retval
=
false
;
retval
=
false
;
break
;
/* can stop scanning now */
}
}
}
/* close the relation */
/* close the relation */
...
...
This diff is collapsed.
Click to expand it.
src/include/utils/builtins.h
+
2
−
2
View file @
4a9c2390
...
@@ -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: builtins.h,v 1.7
6
1999/03/1
4 16:4
4:
0
1
momjian
Exp $
* $Id: builtins.h,v 1.7
7
1999/03/1
5 03:2
4:
3
1
tgl
Exp $
*
*
* NOTES
* NOTES
* This should normally only be included by fmgr.h.
* This should normally only be included by fmgr.h.
...
@@ -331,7 +331,7 @@ extern int32 userfntest(int i);
...
@@ -331,7 +331,7 @@ extern int32 userfntest(int i);
#define NonNullValue(v,b) nonnullvalue(v,b)
#define NonNullValue(v,b) nonnullvalue(v,b)
/* not_in.c */
/* not_in.c */
extern
bool
int4notin
(
int
16
not_in_arg
,
char
*
relation_and_attr
);
extern
bool
int4notin
(
int
32
not_in_arg
,
char
*
relation_and_attr
);
extern
bool
oidnotin
(
Oid
the_oid
,
char
*
compare
);
extern
bool
oidnotin
(
Oid
the_oid
,
char
*
compare
);
/* oid.c */
/* oid.c */
...
...
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