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
5285b357
Commit
5285b357
authored
Feb 27, 2005
by
Neil Conway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add explicit casts between int4 and boolean. Patch from Sean Chittenden,
editorializing by Neil Conway. Catalog version bumped.
parent
2d22f161
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
6 deletions
+36
-6
src/backend/utils/adt/int.c
src/backend/utils/adt/int.c
+20
-1
src/include/catalog/catversion.h
src/include/catalog/catversion.h
+2
-2
src/include/catalog/pg_cast.h
src/include/catalog/pg_cast.h
+5
-1
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+6
-1
src/include/utils/builtins.h
src/include/utils/builtins.h
+3
-1
No files found.
src/backend/utils/adt/int.c
View file @
5285b357
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.6
4 2004/12/31 22:01:22 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.6
5 2005/02/27 08:31:30 neilc
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -361,6 +361,25 @@ text_int4(PG_FUNCTION_ARGS)
...
@@ -361,6 +361,25 @@ text_int4(PG_FUNCTION_ARGS)
return
result
;
return
result
;
}
}
/* Cast int4 -> bool */
Datum
int4_bool
(
PG_FUNCTION_ARGS
)
{
if
(
PG_GETARG_INT32
(
0
)
==
0
)
PG_RETURN_BOOL
(
false
);
else
PG_RETURN_BOOL
(
true
);
}
/* Cast bool -> int4 */
Datum
bool_int4
(
PG_FUNCTION_ARGS
)
{
if
(
PG_GETARG_BOOL
(
0
)
==
false
)
PG_RETURN_INT32
(
0
);
else
PG_RETURN_INT32
(
1
);
}
/*
/*
* ============================
* ============================
...
...
src/include/catalog/catversion.h
View file @
5285b357
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.25
5 2005/02/26 18:43:34 tgl
Exp $
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.25
6 2005/02/27 08:31:30 neilc
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -53,6 +53,6 @@
...
@@ -53,6 +53,6 @@
*/
*/
/* yyyymmddN */
/* yyyymmddN */
#define CATALOG_VERSION_NO 2005022
6
1
#define CATALOG_VERSION_NO 2005022
7
1
#endif
#endif
src/include/catalog/pg_cast.h
View file @
5285b357
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*
*
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/include/catalog/pg_cast.h,v 1.1
7 2005/01/01 05:43:09 momjian
Exp $
* $PostgreSQL: pgsql/src/include/catalog/pg_cast.h,v 1.1
8 2005/02/27 08:31:30 neilc
Exp $
*
*
* NOTES
* NOTES
* the genbki.sh script reads this file and generates .bki
* the genbki.sh script reads this file and generates .bki
...
@@ -101,6 +101,10 @@ DATA(insert ( 1700 23 1744 a ));
...
@@ -101,6 +101,10 @@ DATA(insert ( 1700 23 1744 a ));
DATA
(
insert
(
1700
700
1745
i
));
DATA
(
insert
(
1700
700
1745
i
));
DATA
(
insert
(
1700
701
1746
i
));
DATA
(
insert
(
1700
701
1746
i
));
/* Allow explicit coercions between int4 and bool */
DATA
(
insert
(
23
16
2557
e
));
DATA
(
insert
(
16
23
2558
e
));
/*
/*
* OID category: allow implicit conversion from any integral type (including
* OID category: allow implicit conversion from any integral type (including
* int8, to support OID literals > 2G) to OID, as well as assignment coercion
* int8, to support OID literals > 2G) to OID, as well as assignment coercion
...
...
src/include/catalog/pg_proc.h
View file @
5285b357
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.35
0 2005/02/26 18:43:34 tgl
Exp $
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.35
1 2005/02/27 08:31:30 neilc
Exp $
*
*
* NOTES
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
* The script catalog/genbki.sh reads this file and generates .bki
...
@@ -3604,6 +3604,11 @@ DATA(insert OID = 2550 ( integer_pl_date PGNSP PGUID 14 f f t f i 2 1082 "23 1
...
@@ -3604,6 +3604,11 @@ DATA(insert OID = 2550 ( integer_pl_date PGNSP PGUID 14 f f t f i 2 1082 "23 1
DATA
(
insert
OID
=
2556
(
pg_tablespace_databases
PGNSP
PGUID
12
f
f
t
t
s
1
26
"26"
_null_
pg_tablespace_databases
-
_null_
));
DATA
(
insert
OID
=
2556
(
pg_tablespace_databases
PGNSP
PGUID
12
f
f
t
t
s
1
26
"26"
_null_
pg_tablespace_databases
-
_null_
));
DESCR
(
"returns database oids in a tablespace"
);
DESCR
(
"returns database oids in a tablespace"
);
DATA
(
insert
OID
=
2557
(
bool
PGNSP
PGUID
12
f
f
t
f
i
1
16
"23"
_null_
int4_bool
-
_null_
));
DESCR
(
"convert int4 to boolean"
);
DATA
(
insert
OID
=
2558
(
int4
PGNSP
PGUID
12
f
f
t
f
i
1
23
"16"
_null_
bool_int4
-
_null_
));
DESCR
(
"convert boolean to int4"
);
/*
/*
* Symbolic values for provolatile column: these indicate whether the result
* Symbolic values for provolatile column: these indicate whether the result
...
...
src/include/utils/builtins.h
View file @
5285b357
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.25
2 2004/12/31 22:03:45 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.25
3 2005/02/27 08:31:30 neilc
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -111,6 +111,8 @@ extern Datum i2toi4(PG_FUNCTION_ARGS);
...
@@ -111,6 +111,8 @@ extern Datum i2toi4(PG_FUNCTION_ARGS);
extern
Datum
i4toi2
(
PG_FUNCTION_ARGS
);
extern
Datum
i4toi2
(
PG_FUNCTION_ARGS
);
extern
Datum
int2_text
(
PG_FUNCTION_ARGS
);
extern
Datum
int2_text
(
PG_FUNCTION_ARGS
);
extern
Datum
text_int2
(
PG_FUNCTION_ARGS
);
extern
Datum
text_int2
(
PG_FUNCTION_ARGS
);
extern
Datum
int4_bool
(
PG_FUNCTION_ARGS
);
extern
Datum
bool_int4
(
PG_FUNCTION_ARGS
);
extern
Datum
int4_text
(
PG_FUNCTION_ARGS
);
extern
Datum
int4_text
(
PG_FUNCTION_ARGS
);
extern
Datum
text_int4
(
PG_FUNCTION_ARGS
);
extern
Datum
text_int4
(
PG_FUNCTION_ARGS
);
extern
Datum
int4eq
(
PG_FUNCTION_ARGS
);
extern
Datum
int4eq
(
PG_FUNCTION_ARGS
);
...
...
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