1998-07-08 10:10:30 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1999-02-13 18:22:53 -05:00
|
|
|
* int8.h
|
1998-07-08 10:10:30 -04:00
|
|
|
* Declarations for operations on 64-bit integers.
|
|
|
|
|
*
|
|
|
|
|
*
|
2016-01-02 13:33:40 -05:00
|
|
|
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
2000-01-26 00:58:53 -05:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1998-07-08 10:10:30 -04:00
|
|
|
*
|
2010-09-20 16:08:53 -04:00
|
|
|
* src/include/utils/int8.h
|
1998-07-08 10:10:30 -04:00
|
|
|
*
|
|
|
|
|
* NOTES
|
|
|
|
|
* These data types are supported on all 64-bit architectures, and may
|
1998-09-01 00:40:42 -04:00
|
|
|
* be supported through libraries on some 32-bit machines. If your machine
|
|
|
|
|
* is not currently supported, then please try to make it so, then post
|
|
|
|
|
* patches to the postgresql.org hackers mailing list.
|
1998-07-08 10:10:30 -04:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
#ifndef INT8_H
|
|
|
|
|
#define INT8_H
|
|
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
#include "fmgr.h"
|
1999-03-14 20:43:07 -05:00
|
|
|
|
2002-04-23 11:45:30 -04:00
|
|
|
|
Extend pg_cast castimplicit column to a three-way value; this allows us
to be flexible about assignment casts without introducing ambiguity in
operator/function resolution. Introduce a well-defined promotion hierarchy
for numeric datatypes (int2->int4->int8->numeric->float4->float8).
Change make_const to initially label numeric literals as int4, int8, or
numeric (never float8 anymore).
Explicitly mark Func and RelabelType nodes to indicate whether they came
from a function call, explicit cast, or implicit cast; use this to do
reverse-listing more accurately and without so many heuristics.
Explicit casts to char, varchar, bit, varbit will truncate or pad without
raising an error (the pre-7.2 behavior), while assigning to a column without
any explicit cast will still raise an error for wrong-length data like 7.3.
This more nearly follows the SQL spec than 7.2 behavior (we should be
reporting a 'completion condition' in the explicit-cast cases, but we have
no mechanism for that, so just do silent truncation).
Fix some problems with enforcement of typmod for array elements;
it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
Provide a generalized array_length_coerce() function to replace the
specialized per-array-type functions that used to be needed (and were
missing for NUMERIC as well as all the datetime types).
Add missing conversions int8<->float4, text<->numeric, oid<->int8.
initdb forced.
2002-09-18 17:35:25 -04:00
|
|
|
extern bool scanint8(const char *str, bool errorOK, int64 *result);
|
|
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int8in(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8out(PG_FUNCTION_ARGS);
|
2003-05-09 11:44:42 -04:00
|
|
|
extern Datum int8recv(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8send(PG_FUNCTION_ARGS);
|
1999-05-25 18:43:53 -04:00
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int8eq(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8ne(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8lt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8gt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8le(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8ge(PG_FUNCTION_ARGS);
|
1999-05-25 18:43:53 -04:00
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int84eq(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84ne(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84lt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84gt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84le(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84ge(PG_FUNCTION_ARGS);
|
1999-05-25 18:43:53 -04:00
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int48eq(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48ne(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48lt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48gt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48le(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48ge(PG_FUNCTION_ARGS);
|
1999-05-25 18:43:53 -04:00
|
|
|
|
2000-07-28 01:07:49 -04:00
|
|
|
extern Datum int82eq(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82ne(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82lt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82gt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82le(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82ge(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
|
|
extern Datum int28eq(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28ne(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28lt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28gt(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28le(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28ge(PG_FUNCTION_ARGS);
|
|
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int8um(PG_FUNCTION_ARGS);
|
2001-06-06 20:09:32 -04:00
|
|
|
extern Datum int8up(PG_FUNCTION_ARGS);
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int8pl(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8mi(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8mul(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8div(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8abs(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8mod(PG_FUNCTION_ARGS);
|
2001-08-14 18:21:59 -04:00
|
|
|
extern Datum int8inc(PG_FUNCTION_ARGS);
|
2014-04-12 20:33:09 -04:00
|
|
|
extern Datum int8dec(PG_FUNCTION_ARGS);
|
2006-07-28 14:33:04 -04:00
|
|
|
extern Datum int8inc_any(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8inc_float8_float8(PG_FUNCTION_ARGS);
|
2014-04-12 20:33:09 -04:00
|
|
|
extern Datum int8dec_any(PG_FUNCTION_ARGS);
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int8larger(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8smaller(PG_FUNCTION_ARGS);
|
1999-05-25 18:43:53 -04:00
|
|
|
|
2000-10-24 16:16:48 -04:00
|
|
|
extern Datum int8and(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8or(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8xor(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8not(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8shl(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int8shr(PG_FUNCTION_ARGS);
|
|
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int84pl(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84mi(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84mul(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84div(PG_FUNCTION_ARGS);
|
1998-07-08 10:10:30 -04:00
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int48pl(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48mi(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48mul(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int48div(PG_FUNCTION_ARGS);
|
1998-07-08 10:10:30 -04:00
|
|
|
|
2008-06-17 15:10:56 -04:00
|
|
|
extern Datum int82pl(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82mi(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82mul(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82div(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
|
|
extern Datum int28pl(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28mi(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28mul(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int28div(PG_FUNCTION_ARGS);
|
|
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum int48(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int84(PG_FUNCTION_ARGS);
|
2000-04-12 13:17:23 -04:00
|
|
|
|
2001-10-25 10:10:07 -04:00
|
|
|
extern Datum int28(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum int82(PG_FUNCTION_ARGS);
|
|
|
|
|
|
2000-06-13 03:35:40 -04:00
|
|
|
extern Datum i8tod(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum dtoi8(PG_FUNCTION_ARGS);
|
1998-07-08 10:10:30 -04:00
|
|
|
|
Extend pg_cast castimplicit column to a three-way value; this allows us
to be flexible about assignment casts without introducing ambiguity in
operator/function resolution. Introduce a well-defined promotion hierarchy
for numeric datatypes (int2->int4->int8->numeric->float4->float8).
Change make_const to initially label numeric literals as int4, int8, or
numeric (never float8 anymore).
Explicitly mark Func and RelabelType nodes to indicate whether they came
from a function call, explicit cast, or implicit cast; use this to do
reverse-listing more accurately and without so many heuristics.
Explicit casts to char, varchar, bit, varbit will truncate or pad without
raising an error (the pre-7.2 behavior), while assigning to a column without
any explicit cast will still raise an error for wrong-length data like 7.3.
This more nearly follows the SQL spec than 7.2 behavior (we should be
reporting a 'completion condition' in the explicit-cast cases, but we have
no mechanism for that, so just do silent truncation).
Fix some problems with enforcement of typmod for array elements;
it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
Provide a generalized array_length_coerce() function to replace the
specialized per-array-type functions that used to be needed (and were
missing for NUMERIC as well as all the datetime types).
Add missing conversions int8<->float4, text<->numeric, oid<->int8.
initdb forced.
2002-09-18 17:35:25 -04:00
|
|
|
extern Datum i8tof(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum ftoi8(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
|
|
extern Datum i8tooid(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum oidtoi8(PG_FUNCTION_ARGS);
|
|
|
|
|
|
2004-02-03 03:29:57 -05:00
|
|
|
extern Datum generate_series_int8(PG_FUNCTION_ARGS);
|
|
|
|
|
extern Datum generate_series_step_int8(PG_FUNCTION_ARGS);
|
|
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* INT8_H */
|