PostgreSQL Source Code git master
Loading...
Searching...
No Matches
int8.c File Reference
#include "postgres.h"
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include "common/int.h"
#include "funcapi.h"
#include "libpq/pqformat.h"
#include "nodes/nodeFuncs.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
Include dependency graph for int8.c:

Go to the source code of this file.

Data Structures

struct  generate_series_fctx
 

Functions

Datum int8in (PG_FUNCTION_ARGS)
 
Datum int8out (PG_FUNCTION_ARGS)
 
Datum int8recv (PG_FUNCTION_ARGS)
 
Datum int8send (PG_FUNCTION_ARGS)
 
Datum int8eq (PG_FUNCTION_ARGS)
 
Datum int8ne (PG_FUNCTION_ARGS)
 
Datum int8lt (PG_FUNCTION_ARGS)
 
Datum int8gt (PG_FUNCTION_ARGS)
 
Datum int8le (PG_FUNCTION_ARGS)
 
Datum int8ge (PG_FUNCTION_ARGS)
 
Datum int84eq (PG_FUNCTION_ARGS)
 
Datum int84ne (PG_FUNCTION_ARGS)
 
Datum int84lt (PG_FUNCTION_ARGS)
 
Datum int84gt (PG_FUNCTION_ARGS)
 
Datum int84le (PG_FUNCTION_ARGS)
 
Datum int84ge (PG_FUNCTION_ARGS)
 
Datum int48eq (PG_FUNCTION_ARGS)
 
Datum int48ne (PG_FUNCTION_ARGS)
 
Datum int48lt (PG_FUNCTION_ARGS)
 
Datum int48gt (PG_FUNCTION_ARGS)
 
Datum int48le (PG_FUNCTION_ARGS)
 
Datum int48ge (PG_FUNCTION_ARGS)
 
Datum int82eq (PG_FUNCTION_ARGS)
 
Datum int82ne (PG_FUNCTION_ARGS)
 
Datum int82lt (PG_FUNCTION_ARGS)
 
Datum int82gt (PG_FUNCTION_ARGS)
 
Datum int82le (PG_FUNCTION_ARGS)
 
Datum int82ge (PG_FUNCTION_ARGS)
 
Datum int28eq (PG_FUNCTION_ARGS)
 
Datum int28ne (PG_FUNCTION_ARGS)
 
Datum int28lt (PG_FUNCTION_ARGS)
 
Datum int28gt (PG_FUNCTION_ARGS)
 
Datum int28le (PG_FUNCTION_ARGS)
 
Datum int28ge (PG_FUNCTION_ARGS)
 
Datum in_range_int8_int8 (PG_FUNCTION_ARGS)
 
Datum int8um (PG_FUNCTION_ARGS)
 
Datum int8up (PG_FUNCTION_ARGS)
 
Datum int8pl (PG_FUNCTION_ARGS)
 
Datum int8mi (PG_FUNCTION_ARGS)
 
Datum int8mul (PG_FUNCTION_ARGS)
 
Datum int8div (PG_FUNCTION_ARGS)
 
Datum int8abs (PG_FUNCTION_ARGS)
 
Datum int8mod (PG_FUNCTION_ARGS)
 
static int64 int8gcd_internal (int64 arg1, int64 arg2)
 
Datum int8gcd (PG_FUNCTION_ARGS)
 
Datum int8lcm (PG_FUNCTION_ARGS)
 
Datum int8inc (PG_FUNCTION_ARGS)
 
Datum int8dec (PG_FUNCTION_ARGS)
 
Datum int8inc_any (PG_FUNCTION_ARGS)
 
Datum int8inc_float8_float8 (PG_FUNCTION_ARGS)
 
Datum int8dec_any (PG_FUNCTION_ARGS)
 
Datum int8inc_support (PG_FUNCTION_ARGS)
 
Datum int8larger (PG_FUNCTION_ARGS)
 
Datum int8smaller (PG_FUNCTION_ARGS)
 
Datum int84pl (PG_FUNCTION_ARGS)
 
Datum int84mi (PG_FUNCTION_ARGS)
 
Datum int84mul (PG_FUNCTION_ARGS)
 
Datum int84div (PG_FUNCTION_ARGS)
 
Datum int48pl (PG_FUNCTION_ARGS)
 
Datum int48mi (PG_FUNCTION_ARGS)
 
Datum int48mul (PG_FUNCTION_ARGS)
 
Datum int48div (PG_FUNCTION_ARGS)
 
Datum int82pl (PG_FUNCTION_ARGS)
 
Datum int82mi (PG_FUNCTION_ARGS)
 
Datum int82mul (PG_FUNCTION_ARGS)
 
Datum int82div (PG_FUNCTION_ARGS)
 
Datum int28pl (PG_FUNCTION_ARGS)
 
Datum int28mi (PG_FUNCTION_ARGS)
 
Datum int28mul (PG_FUNCTION_ARGS)
 
Datum int28div (PG_FUNCTION_ARGS)
 
Datum int8and (PG_FUNCTION_ARGS)
 
Datum int8or (PG_FUNCTION_ARGS)
 
Datum int8xor (PG_FUNCTION_ARGS)
 
Datum int8not (PG_FUNCTION_ARGS)
 
Datum int8shl (PG_FUNCTION_ARGS)
 
Datum int8shr (PG_FUNCTION_ARGS)
 
Datum int48 (PG_FUNCTION_ARGS)
 
Datum int84 (PG_FUNCTION_ARGS)
 
Datum int28 (PG_FUNCTION_ARGS)
 
Datum int82 (PG_FUNCTION_ARGS)
 
Datum i8tod (PG_FUNCTION_ARGS)
 
Datum dtoi8 (PG_FUNCTION_ARGS)
 
Datum i8tof (PG_FUNCTION_ARGS)
 
Datum ftoi8 (PG_FUNCTION_ARGS)
 
Datum i8tooid (PG_FUNCTION_ARGS)
 
Datum oidtoi8 (PG_FUNCTION_ARGS)
 
Datum oidtooid8 (PG_FUNCTION_ARGS)
 
Datum generate_series_int8 (PG_FUNCTION_ARGS)
 
Datum generate_series_step_int8 (PG_FUNCTION_ARGS)
 
Datum generate_series_int8_support (PG_FUNCTION_ARGS)
 

Function Documentation

◆ dtoi8()

Datum dtoi8 ( PG_FUNCTION_ARGS  )

Definition at line 1308 of file int8.c.

1309{
1310 float8 num = PG_GETARG_FLOAT8(0);
1311
1312 /*
1313 * Get rid of any fractional part in the input. This is so we don't fail
1314 * on just-out-of-range values that would round into range. Note
1315 * assumption that rint() will pass through a NaN or Inf unchanged.
1316 */
1317 num = rint(num);
1318
1319 /* Range check */
1320 if (unlikely(isnan(num) || !FLOAT8_FITS_IN_INT64(num)))
1321 ereturn(fcinfo->context, (Datum) 0,
1323 errmsg("bigint out of range")));
1324
1325 PG_RETURN_INT64((int64) num);
1326}
int64_t int64
Definition c.h:621
double float8
Definition c.h:714
#define FLOAT8_FITS_IN_INT64(num)
Definition c.h:1179
#define unlikely(x)
Definition c.h:438
int errcode(int sqlerrcode)
Definition elog.c:875
#define ereturn(context, dummy_value,...)
Definition elog.h:280
#define PG_GETARG_FLOAT8(n)
Definition fmgr.h:283
#define PG_RETURN_INT64(x)
Definition fmgr.h:370
static char * errmsg
uint64_t Datum
Definition postgres.h:70
static int fb(int x)

References ereturn, errcode(), errmsg, fb(), FLOAT8_FITS_IN_INT64, PG_GETARG_FLOAT8, PG_RETURN_INT64, and unlikely.

Referenced by int8_to_char().

◆ ftoi8()

Datum ftoi8 ( PG_FUNCTION_ARGS  )

Definition at line 1344 of file int8.c.

1345{
1346 float4 num = PG_GETARG_FLOAT4(0);
1347
1348 /*
1349 * Get rid of any fractional part in the input. This is so we don't fail
1350 * on just-out-of-range values that would round into range. Note
1351 * assumption that rint() will pass through a NaN or Inf unchanged.
1352 */
1353 num = rint(num);
1354
1355 /* Range check */
1356 if (unlikely(isnan(num) || !FLOAT4_FITS_IN_INT64(num)))
1357 ereturn(fcinfo->context, (Datum) 0,
1359 errmsg("bigint out of range")));
1360
1361 PG_RETURN_INT64((int64) num);
1362}
#define FLOAT4_FITS_IN_INT64(num)
Definition c.h:1173
float float4
Definition c.h:713
#define PG_GETARG_FLOAT4(n)
Definition fmgr.h:282

References ereturn, errcode(), errmsg, fb(), FLOAT4_FITS_IN_INT64, PG_GETARG_FLOAT4, PG_RETURN_INT64, and unlikely.

◆ generate_series_int8()

Datum generate_series_int8 ( PG_FUNCTION_ARGS  )

Definition at line 1397 of file int8.c.

1398{
1399 return generate_series_step_int8(fcinfo);
1400}
Datum generate_series_step_int8(PG_FUNCTION_ARGS)
Definition int8.c:1403

References generate_series_step_int8().

◆ generate_series_int8_support()

Datum generate_series_int8_support ( PG_FUNCTION_ARGS  )

Definition at line 1479 of file int8.c.

1480{
1482 Node *ret = NULL;
1483
1485 {
1486 /* Try to estimate the number of rows returned */
1488
1489 if (is_funcclause(req->node)) /* be paranoid */
1490 {
1491 List *args = ((FuncExpr *) req->node)->args;
1492 Node *arg1,
1493 *arg2,
1494 *arg3;
1495
1496 /* We can use estimated argument values here */
1498 arg2 = estimate_expression_value(req->root, lsecond(args));
1499 if (list_length(args) >= 3)
1500 arg3 = estimate_expression_value(req->root, lthird(args));
1501 else
1502 arg3 = NULL;
1503
1504 /*
1505 * If any argument is constant NULL, we can safely assume that
1506 * zero rows are returned. Otherwise, if they're all non-NULL
1507 * constants, we can calculate the number of rows that will be
1508 * returned. Use double arithmetic to avoid overflow hazards.
1509 */
1510 if ((IsA(arg1, Const) &&
1511 ((Const *) arg1)->constisnull) ||
1512 (IsA(arg2, Const) &&
1513 ((Const *) arg2)->constisnull) ||
1514 (arg3 != NULL && IsA(arg3, Const) &&
1515 ((Const *) arg3)->constisnull))
1516 {
1517 req->rows = 0;
1518 ret = (Node *) req;
1519 }
1520 else if (IsA(arg1, Const) &&
1521 IsA(arg2, Const) &&
1522 (arg3 == NULL || IsA(arg3, Const)))
1523 {
1524 double start,
1525 finish,
1526 step;
1527
1529 finish = DatumGetInt64(((Const *) arg2)->constvalue);
1530 step = arg3 ? DatumGetInt64(((Const *) arg3)->constvalue) : 1;
1531
1532 /* This equation works for either sign of step */
1533 if (step != 0)
1534 {
1535 req->rows = floor((finish - start + step) / step);
1536 ret = (Node *) req;
1537 }
1538 }
1539 }
1540 }
1541
1542 PG_RETURN_POINTER(ret);
1543}
Node * estimate_expression_value(PlannerInfo *root, Node *node)
Definition clauses.c:2641
#define PG_GETARG_POINTER(n)
Definition fmgr.h:277
#define PG_RETURN_POINTER(x)
Definition fmgr.h:363
return str start
static bool is_funcclause(const void *clause)
Definition nodeFuncs.h:69
#define IsA(nodeptr, _type_)
Definition nodes.h:164
static int list_length(const List *l)
Definition pg_list.h:152
#define lthird(l)
Definition pg_list.h:188
#define linitial(l)
Definition pg_list.h:178
#define lsecond(l)
Definition pg_list.h:183
static int64 DatumGetInt64(Datum X)
Definition postgres.h:416
Definition pg_list.h:54
Definition nodes.h:135

References DatumGetInt64(), estimate_expression_value(), fb(), is_funcclause(), IsA, linitial, list_length(), lsecond, lthird, PG_GETARG_POINTER, PG_RETURN_POINTER, and start.

◆ generate_series_step_int8()

Datum generate_series_step_int8 ( PG_FUNCTION_ARGS  )

Definition at line 1403 of file int8.c.

1404{
1407 int64 result;
1408 MemoryContext oldcontext;
1409
1410 /* stuff done only on the first call of the function */
1411 if (SRF_IS_FIRSTCALL())
1412 {
1414 int64 finish = PG_GETARG_INT64(1);
1415 int64 step = 1;
1416
1417 /* see if we were given an explicit step size */
1418 if (PG_NARGS() == 3)
1419 step = PG_GETARG_INT64(2);
1420 if (step == 0)
1421 ereport(ERROR,
1423 errmsg("step size cannot equal zero")));
1424
1425 /* create a function context for cross-call persistence */
1427
1428 /*
1429 * switch to memory context appropriate for multiple function calls
1430 */
1431 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
1432
1433 /* allocate memory for user context */
1435
1436 /*
1437 * Use fctx to keep state from call to call. Seed current with the
1438 * original start value
1439 */
1440 fctx->current = start;
1441 fctx->finish = finish;
1442 fctx->step = step;
1443
1444 funcctx->user_fctx = fctx;
1445 MemoryContextSwitchTo(oldcontext);
1446 }
1447
1448 /* stuff done on every call of the function */
1450
1451 /*
1452 * get the saved state and use current as the result for this iteration
1453 */
1454 fctx = funcctx->user_fctx;
1455 result = fctx->current;
1456
1457 if ((fctx->step > 0 && fctx->current <= fctx->finish) ||
1458 (fctx->step < 0 && fctx->current >= fctx->finish))
1459 {
1460 /*
1461 * Increment current in preparation for next iteration. If next-value
1462 * computation overflows, this is the final result.
1463 */
1464 if (pg_add_s64_overflow(fctx->current, fctx->step, &fctx->current))
1465 fctx->step = 0;
1466
1467 /* do when there is more left to send */
1469 }
1470 else
1471 /* do when there is no more left */
1473}
uint32 result
#define ERROR
Definition elog.h:40
#define ereport(elevel,...)
Definition elog.h:152
#define palloc_object(type)
Definition fe_memutils.h:89
#define PG_NARGS()
Definition fmgr.h:203
#define PG_GETARG_INT64(n)
Definition fmgr.h:284
#define SRF_IS_FIRSTCALL()
Definition funcapi.h:304
#define SRF_PERCALL_SETUP()
Definition funcapi.h:308
#define SRF_RETURN_NEXT(_funcctx, _result)
Definition funcapi.h:310
#define SRF_FIRSTCALL_INIT()
Definition funcapi.h:306
#define SRF_RETURN_DONE(_funcctx)
Definition funcapi.h:328
static bool pg_add_s64_overflow(int64 a, int64 b, int64 *result)
Definition int.h:235
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition palloc.h:138
static Datum Int64GetDatum(int64 X)
Definition postgres.h:426

References ereport, errcode(), errmsg, ERROR, fb(), Int64GetDatum(), MemoryContextSwitchTo(), palloc_object, pg_add_s64_overflow(), PG_GETARG_INT64, PG_NARGS, result, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and start.

Referenced by generate_series_int8().

◆ i8tod()

Datum i8tod ( PG_FUNCTION_ARGS  )

Definition at line 1293 of file int8.c.

1294{
1296 float8 result;
1297
1298 result = arg;
1299
1301}
Datum arg
Definition elog.c:1323
#define PG_RETURN_FLOAT8(x)
Definition fmgr.h:369

References arg, PG_GETARG_INT64, PG_RETURN_FLOAT8, and result.

◆ i8tof()

Datum i8tof ( PG_FUNCTION_ARGS  )

Definition at line 1329 of file int8.c.

1330{
1332 float4 result;
1333
1334 result = arg;
1335
1337}
#define PG_RETURN_FLOAT4(x)
Definition fmgr.h:368

References arg, PG_GETARG_INT64, PG_RETURN_FLOAT4, and result.

◆ i8tooid()

Datum i8tooid ( PG_FUNCTION_ARGS  )

Definition at line 1365 of file int8.c.

1366{
1368
1369 if (unlikely(arg < 0) || unlikely(arg > PG_UINT32_MAX))
1370 ereturn(fcinfo->context, (Datum) 0,
1372 errmsg("OID out of range")));
1373
1375}
#define PG_UINT32_MAX
Definition c.h:674
#define PG_RETURN_OID(x)
Definition fmgr.h:361
unsigned int Oid

References arg, ereturn, errcode(), errmsg, fb(), PG_GETARG_INT64, PG_RETURN_OID, PG_UINT32_MAX, and unlikely.

◆ in_range_int8_int8()

Datum in_range_int8_int8 ( PG_FUNCTION_ARGS  )

Definition at line 408 of file int8.c.

409{
411 int64 base = PG_GETARG_INT64(1);
412 int64 offset = PG_GETARG_INT64(2);
413 bool sub = PG_GETARG_BOOL(3);
414 bool less = PG_GETARG_BOOL(4);
415 int64 sum;
416
417 if (offset < 0)
420 errmsg("invalid preceding or following size in window function")));
421
422 if (sub)
423 offset = -offset; /* cannot overflow */
424
425 if (unlikely(pg_add_s64_overflow(base, offset, &sum)))
426 {
427 /*
428 * If sub is false, the true sum is surely more than val, so correct
429 * answer is the same as "less". If sub is true, the true sum is
430 * surely less than val, so the answer is "!less".
431 */
432 PG_RETURN_BOOL(sub ? !less : less);
433 }
434
435 if (less)
436 PG_RETURN_BOOL(val <= sum);
437 else
438 PG_RETURN_BOOL(val >= sum);
439}
#define PG_GETARG_BOOL(n)
Definition fmgr.h:274
#define PG_RETURN_BOOL(x)
Definition fmgr.h:360
long val
Definition informix.c:689

References ereport, errcode(), errmsg, ERROR, fb(), pg_add_s64_overflow(), PG_GETARG_BOOL, PG_GETARG_INT64, PG_RETURN_BOOL, unlikely, and val.

◆ int28()

Datum int28 ( PG_FUNCTION_ARGS  )

Definition at line 1272 of file int8.c.

1273{
1275
1277}
int16_t int16
Definition c.h:619
#define PG_GETARG_INT16(n)
Definition fmgr.h:271

References arg, PG_GETARG_INT16, and PG_RETURN_INT64.

◆ int28div()

Datum int28div ( PG_FUNCTION_ARGS  )

Definition at line 1164 of file int8.c.

1165{
1168
1169 if (unlikely(arg2 == 0))
1170 {
1171 ereport(ERROR,
1173 errmsg("division by zero")));
1174 /* ensure compiler realizes we mustn't reach the division (gcc bug) */
1176 }
1177
1178 /* No overflow is possible */
1180}
#define PG_RETURN_NULL()
Definition fmgr.h:346

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT16, PG_GETARG_INT64, PG_RETURN_INT64, PG_RETURN_NULL, and unlikely.

◆ int28eq()

Datum int28eq ( PG_FUNCTION_ARGS  )

Definition at line 348 of file int8.c.

349{
352
354}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int28ge()

Datum int28ge ( PG_FUNCTION_ARGS  )

Definition at line 393 of file int8.c.

394{
397
399}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int28gt()

Datum int28gt ( PG_FUNCTION_ARGS  )

Definition at line 375 of file int8.c.

376{
379
381}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int28le()

Datum int28le ( PG_FUNCTION_ARGS  )

Definition at line 384 of file int8.c.

385{
388
390}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int28lt()

Datum int28lt ( PG_FUNCTION_ARGS  )

Definition at line 366 of file int8.c.

367{
370
372}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int28mi()

Datum int28mi ( PG_FUNCTION_ARGS  )

Definition at line 1136 of file int8.c.

1137{
1140 int64 result;
1141
1143 ereport(ERROR,
1145 errmsg("bigint out of range")));
1147}
static bool pg_sub_s64_overflow(int64 a, int64 b, int64 *result)
Definition int.h:262

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT16, PG_GETARG_INT64, PG_RETURN_INT64, pg_sub_s64_overflow(), result, and unlikely.

◆ int28mul()

Datum int28mul ( PG_FUNCTION_ARGS  )

Definition at line 1150 of file int8.c.

1151{
1154 int64 result;
1155
1157 ereport(ERROR,
1159 errmsg("bigint out of range")));
1161}
static bool pg_mul_s64_overflow(int64 a, int64 b, int64 *result)
Definition int.h:293

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT16, PG_GETARG_INT64, pg_mul_s64_overflow(), PG_RETURN_INT64, result, and unlikely.

◆ int28ne()

Datum int28ne ( PG_FUNCTION_ARGS  )

Definition at line 357 of file int8.c.

358{
361
363}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int28pl()

Datum int28pl ( PG_FUNCTION_ARGS  )

◆ int48()

Datum int48 ( PG_FUNCTION_ARGS  )

Definition at line 1251 of file int8.c.

1252{
1254
1256}
int32_t int32
Definition c.h:620
#define PG_GETARG_INT32(n)
Definition fmgr.h:269

References arg, PG_GETARG_INT32, and PG_RETURN_INT64.

◆ int48div()

Datum int48div ( PG_FUNCTION_ARGS  )

Definition at line 1022 of file int8.c.

1023{
1026
1027 if (unlikely(arg2 == 0))
1028 {
1029 ereport(ERROR,
1031 errmsg("division by zero")));
1032 /* ensure compiler realizes we mustn't reach the division (gcc bug) */
1034 }
1035
1036 /* No overflow is possible */
1038}

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT32, PG_GETARG_INT64, PG_RETURN_INT64, PG_RETURN_NULL, and unlikely.

◆ int48eq()

Datum int48eq ( PG_FUNCTION_ARGS  )

Definition at line 232 of file int8.c.

233{
236
238}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int48ge()

Datum int48ge ( PG_FUNCTION_ARGS  )

Definition at line 277 of file int8.c.

278{
281
283}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int48gt()

Datum int48gt ( PG_FUNCTION_ARGS  )

Definition at line 259 of file int8.c.

260{
263
265}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int48le()

Datum int48le ( PG_FUNCTION_ARGS  )

Definition at line 268 of file int8.c.

269{
272
274}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int48lt()

Datum int48lt ( PG_FUNCTION_ARGS  )

Definition at line 250 of file int8.c.

251{
254
256}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int48mi()

◆ int48mul()

Datum int48mul ( PG_FUNCTION_ARGS  )

◆ int48ne()

Datum int48ne ( PG_FUNCTION_ARGS  )

Definition at line 241 of file int8.c.

242{
245
247}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int48pl()

◆ int82()

Datum int82 ( PG_FUNCTION_ARGS  )

Definition at line 1280 of file int8.c.

1281{
1283
1285 ereturn(fcinfo->context, (Datum) 0,
1287 errmsg("smallint out of range")));
1288
1290}
#define PG_INT16_MIN
Definition c.h:669
#define PG_INT16_MAX
Definition c.h:670
#define PG_RETURN_INT16(x)
Definition fmgr.h:357

References arg, ereturn, errcode(), errmsg, fb(), PG_GETARG_INT64, PG_INT16_MAX, PG_INT16_MIN, PG_RETURN_INT16, and unlikely.

◆ int82div()

Datum int82div ( PG_FUNCTION_ARGS  )

Definition at line 1083 of file int8.c.

1084{
1087 int64 result;
1088
1089 if (unlikely(arg2 == 0))
1090 {
1091 ereport(ERROR,
1093 errmsg("division by zero")));
1094 /* ensure compiler realizes we mustn't reach the division (gcc bug) */
1096 }
1097
1098 /*
1099 * INT64_MIN / -1 is problematic, since the result can't be represented on
1100 * a two's-complement machine. Some machines produce INT64_MIN, some
1101 * produce zero, some throw an exception. We can dodge the problem by
1102 * recognizing that division by -1 is the same as negation.
1103 */
1104 if (arg2 == -1)
1105 {
1106 if (unlikely(arg1 == PG_INT64_MIN))
1107 ereport(ERROR,
1109 errmsg("bigint out of range")));
1110 result = -arg1;
1112 }
1113
1114 /* No overflow is possible */
1115
1116 result = arg1 / arg2;
1117
1119}
#define PG_INT64_MIN
Definition c.h:675

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT16, PG_GETARG_INT64, PG_INT64_MIN, PG_RETURN_INT64, PG_RETURN_NULL, result, and unlikely.

◆ int82eq()

Datum int82eq ( PG_FUNCTION_ARGS  )

Definition at line 290 of file int8.c.

291{
294
296}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int82ge()

Datum int82ge ( PG_FUNCTION_ARGS  )

Definition at line 335 of file int8.c.

336{
339
341}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int82gt()

Datum int82gt ( PG_FUNCTION_ARGS  )

Definition at line 317 of file int8.c.

318{
321
323}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int82le()

Datum int82le ( PG_FUNCTION_ARGS  )

Definition at line 326 of file int8.c.

327{
330
332}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int82lt()

Datum int82lt ( PG_FUNCTION_ARGS  )

Definition at line 308 of file int8.c.

309{
312
314}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int82mi()

Datum int82mi ( PG_FUNCTION_ARGS  )

◆ int82mul()

Datum int82mul ( PG_FUNCTION_ARGS  )

◆ int82ne()

Datum int82ne ( PG_FUNCTION_ARGS  )

Definition at line 299 of file int8.c.

300{
303
305}

References fb(), PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int82pl()

Datum int82pl ( PG_FUNCTION_ARGS  )

◆ int84()

Datum int84 ( PG_FUNCTION_ARGS  )

Definition at line 1259 of file int8.c.

1260{
1262
1264 ereturn(fcinfo->context, (Datum) 0,
1266 errmsg("integer out of range")));
1267
1269}
#define PG_INT32_MAX
Definition c.h:673
#define PG_INT32_MIN
Definition c.h:672
#define PG_RETURN_INT32(x)
Definition fmgr.h:355

References arg, ereturn, errcode(), errmsg, fb(), PG_GETARG_INT64, PG_INT32_MAX, PG_INT32_MIN, PG_RETURN_INT32, and unlikely.

◆ int84div()

Datum int84div ( PG_FUNCTION_ARGS  )

Definition at line 941 of file int8.c.

942{
946
947 if (arg2 == 0)
948 {
951 errmsg("division by zero")));
952 /* ensure compiler realizes we mustn't reach the division (gcc bug) */
954 }
955
956 /*
957 * INT64_MIN / -1 is problematic, since the result can't be represented on
958 * a two's-complement machine. Some machines produce INT64_MIN, some
959 * produce zero, some throw an exception. We can dodge the problem by
960 * recognizing that division by -1 is the same as negation.
961 */
962 if (arg2 == -1)
963 {
964 if (unlikely(arg1 == PG_INT64_MIN))
967 errmsg("bigint out of range")));
968 result = -arg1;
970 }
971
972 /* No overflow is possible */
973
974 result = arg1 / arg2;
975
977}

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT32, PG_GETARG_INT64, PG_INT64_MIN, PG_RETURN_INT64, PG_RETURN_NULL, result, and unlikely.

◆ int84eq()

Datum int84eq ( PG_FUNCTION_ARGS  )

Definition at line 174 of file int8.c.

175{
178
180}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int84ge()

Datum int84ge ( PG_FUNCTION_ARGS  )

Definition at line 219 of file int8.c.

220{
223
225}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int84gt()

Datum int84gt ( PG_FUNCTION_ARGS  )

Definition at line 201 of file int8.c.

202{
205
207}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int84le()

Datum int84le ( PG_FUNCTION_ARGS  )

Definition at line 210 of file int8.c.

211{
214
216}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int84lt()

Datum int84lt ( PG_FUNCTION_ARGS  )

Definition at line 192 of file int8.c.

193{
196
198}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int84mi()

◆ int84mul()

◆ int84ne()

Datum int84ne ( PG_FUNCTION_ARGS  )

Definition at line 183 of file int8.c.

184{
187
189}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int84pl()

◆ int8abs()

Datum int8abs ( PG_FUNCTION_ARGS  )

Definition at line 554 of file int8.c.

555{
558
559 if (unlikely(arg1 == PG_INT64_MIN))
562 errmsg("bigint out of range")));
563 result = (arg1 < 0) ? -arg1 : arg1;
565}

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT64, PG_INT64_MIN, PG_RETURN_INT64, result, and unlikely.

◆ int8and()

Datum int8and ( PG_FUNCTION_ARGS  )

Definition at line 1194 of file int8.c.

1195{
1198
1200}

References fb(), PG_GETARG_INT64, and PG_RETURN_INT64.

◆ int8dec()

Datum int8dec ( PG_FUNCTION_ARGS  )

Definition at line 742 of file int8.c.

743{
746
750 errmsg("bigint out of range")));
751
753}

References arg, ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT64, PG_RETURN_INT64, pg_sub_s64_overflow(), result, and unlikely.

Referenced by int8dec_any().

◆ int8dec_any()

Datum int8dec_any ( PG_FUNCTION_ARGS  )

Definition at line 778 of file int8.c.

779{
780 return int8dec(fcinfo);
781}
Datum int8dec(PG_FUNCTION_ARGS)
Definition int8.c:742

References int8dec().

◆ int8div()

Datum int8div ( PG_FUNCTION_ARGS  )

Definition at line 511 of file int8.c.

512{
516
517 if (arg2 == 0)
518 {
521 errmsg("division by zero")));
522 /* ensure compiler realizes we mustn't reach the division (gcc bug) */
524 }
525
526 /*
527 * INT64_MIN / -1 is problematic, since the result can't be represented on
528 * a two's-complement machine. Some machines produce INT64_MIN, some
529 * produce zero, some throw an exception. We can dodge the problem by
530 * recognizing that division by -1 is the same as negation.
531 */
532 if (arg2 == -1)
533 {
534 if (unlikely(arg1 == PG_INT64_MIN))
537 errmsg("bigint out of range")));
538 result = -arg1;
540 }
541
542 /* No overflow is possible */
543
544 result = arg1 / arg2;
545
547}

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT64, PG_INT64_MIN, PG_RETURN_INT64, PG_RETURN_NULL, result, and unlikely.

◆ int8eq()

Datum int8eq ( PG_FUNCTION_ARGS  )

Definition at line 116 of file int8.c.

117{
120
122}

References fb(), PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int8gcd()

Datum int8gcd ( PG_FUNCTION_ARGS  )

Definition at line 676 of file int8.c.

677{
681
683
685}
static int64 int8gcd_internal(int64 arg1, int64 arg2)
Definition int8.c:615

References fb(), int8gcd_internal(), PG_GETARG_INT64, PG_RETURN_INT64, and result.

◆ int8gcd_internal()

static int64 int8gcd_internal ( int64  arg1,
int64  arg2 
)
static

Definition at line 615 of file int8.c.

616{
617 int64 swap;
618 int64 a1,
619 a2;
620
621 /*
622 * Put the greater absolute value in arg1.
623 *
624 * This would happen automatically in the loop below, but avoids an
625 * expensive modulo operation, and simplifies the special-case handling
626 * for INT64_MIN below.
627 *
628 * We do this in negative space in order to handle INT64_MIN.
629 */
630 a1 = (arg1 < 0) ? arg1 : -arg1;
631 a2 = (arg2 < 0) ? arg2 : -arg2;
632 if (a1 > a2)
633 {
634 swap = arg1;
635 arg1 = arg2;
636 arg2 = swap;
637 }
638
639 /* Special care needs to be taken with INT64_MIN. See comments above. */
640 if (arg1 == PG_INT64_MIN)
641 {
642 if (arg2 == 0 || arg2 == PG_INT64_MIN)
645 errmsg("bigint out of range")));
646
647 /*
648 * Some machines throw a floating-point exception for INT64_MIN % -1,
649 * which is a bit silly since the correct answer is perfectly
650 * well-defined, namely zero. Guard against this and just return the
651 * result, gcd(INT64_MIN, -1) = 1.
652 */
653 if (arg2 == -1)
654 return 1;
655 }
656
657 /* Use the Euclidean algorithm to find the GCD */
658 while (arg2 != 0)
659 {
660 swap = arg2;
661 arg2 = arg1 % arg2;
662 arg1 = swap;
663 }
664
665 /*
666 * Make sure the result is positive. (We know we don't have INT64_MIN
667 * anymore).
668 */
669 if (arg1 < 0)
670 arg1 = -arg1;
671
672 return arg1;
673}
static const FormData_pg_attribute a1
Definition heap.c:144
static const FormData_pg_attribute a2
Definition heap.c:157

References a1, a2, ereport, errcode(), errmsg, ERROR, fb(), and PG_INT64_MIN.

Referenced by int8gcd(), and int8lcm().

◆ int8ge()

Datum int8ge ( PG_FUNCTION_ARGS  )

Definition at line 161 of file int8.c.

162{
165
167}

References fb(), PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int8gt()

Datum int8gt ( PG_FUNCTION_ARGS  )

Definition at line 143 of file int8.c.

144{
147
149}

References fb(), PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int8in()

Datum int8in ( PG_FUNCTION_ARGS  )

Definition at line 51 of file int8.c.

52{
53 char *num = PG_GETARG_CSTRING(0);
54
55 PG_RETURN_INT64(pg_strtoint64_safe(num, fcinfo->context));
56}
#define PG_GETARG_CSTRING(n)
Definition fmgr.h:278
int64 pg_strtoint64_safe(const char *s, Node *escontext)
Definition numutils.c:649

References PG_GETARG_CSTRING, PG_RETURN_INT64, and pg_strtoint64_safe().

Referenced by defGetInt64(), and executeItemOptUnwrapTarget().

◆ int8inc()

Datum int8inc ( PG_FUNCTION_ARGS  )

Definition at line 728 of file int8.c.

729{
732
736 errmsg("bigint out of range")));
737
739}

References arg, ereport, errcode(), errmsg, ERROR, fb(), pg_add_s64_overflow(), PG_GETARG_INT64, PG_RETURN_INT64, result, and unlikely.

Referenced by int8inc_any(), and int8inc_float8_float8().

◆ int8inc_any()

Datum int8inc_any ( PG_FUNCTION_ARGS  )

Definition at line 766 of file int8.c.

767{
768 return int8inc(fcinfo);
769}
Datum int8inc(PG_FUNCTION_ARGS)
Definition int8.c:728

References int8inc().

◆ int8inc_float8_float8()

Datum int8inc_float8_float8 ( PG_FUNCTION_ARGS  )

Definition at line 772 of file int8.c.

773{
774 return int8inc(fcinfo);
775}

References int8inc().

◆ int8inc_support()

Datum int8inc_support ( PG_FUNCTION_ARGS  )

Definition at line 788 of file int8.c.

789{
791
793 {
796 int frameOptions = req->window_clause->frameOptions;
797
798 /* No ORDER BY clause then all rows are peers */
799 if (req->window_clause->orderClause == NIL)
800 monotonic = MONOTONICFUNC_BOTH;
801 else
802 {
803 /*
804 * Otherwise take into account the frame options. When the frame
805 * bound is the start of the window then the resulting value can
806 * never decrease, therefore is monotonically increasing
807 */
808 if (frameOptions & FRAMEOPTION_START_UNBOUNDED_PRECEDING)
809 monotonic |= MONOTONICFUNC_INCREASING;
810
811 /*
812 * Likewise, if the frame bound is the end of the window then the
813 * resulting value can never decrease.
814 */
815 if (frameOptions & FRAMEOPTION_END_UNBOUNDED_FOLLOWING)
816 monotonic |= MONOTONICFUNC_DECREASING;
817 }
818
819 req->monotonic = monotonic;
821 }
822
824 {
826 Aggref *agg = req->aggref;
827
828 /*
829 * Check for COUNT(ANY) and try to convert to COUNT(*). The input
830 * argument cannot be NULL, we can't have an ORDER BY / DISTINCT in
831 * the aggregate, and agglevelsup must be 0.
832 *
833 * Technically COUNT(ANY) must have 1 arg, but be paranoid and check.
834 */
835 if (agg->aggfnoid == F_COUNT_ANY && list_length(agg->args) == 1)
836 {
837 TargetEntry *tle = (TargetEntry *) linitial(agg->args);
838 Expr *arg = tle->expr;
839
840 /* Check for unsupported cases */
841 if (agg->aggdistinct != NIL || agg->aggorder != NIL ||
842 agg->agglevelsup != 0)
844
845 /* If the arg isn't NULLable, do the conversion */
847 {
848 Aggref *newagg;
849
850 /* We don't expect these to have been set yet */
851 Assert(agg->aggtransno == -1);
852 Assert(agg->aggtranstype == InvalidOid);
853
854 /* Convert COUNT(ANY) to COUNT(*) by making a new Aggref */
856 memcpy(newagg, agg, sizeof(Aggref));
857 newagg->aggfnoid = F_COUNT_;
858
859 /* count(*) has no args */
860 newagg->aggargtypes = NULL;
861 newagg->args = NULL;
862 newagg->aggstar = true;
863 newagg->location = -1;
864
866 }
867 }
868 }
869
871}
#define Assert(condition)
Definition c.h:943
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
bool expr_is_nonnullable(PlannerInfo *root, Expr *expr, NotNullSource source)
Definition clauses.c:4785
#define makeNode(_type_)
Definition nodes.h:161
@ NOTNULL_SOURCE_HASHTABLE
Definition optimizer.h:137
#define FRAMEOPTION_START_UNBOUNDED_PRECEDING
Definition parsenodes.h:617
#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING
Definition parsenodes.h:620
#define NIL
Definition pg_list.h:68
MonotonicFunction
Definition plannodes.h:1838
@ MONOTONICFUNC_NONE
Definition plannodes.h:1839
@ MONOTONICFUNC_DECREASING
Definition plannodes.h:1841
@ MONOTONICFUNC_INCREASING
Definition plannodes.h:1840
@ MONOTONICFUNC_BOTH
Definition plannodes.h:1842
#define InvalidOid

References arg, Assert, expr_is_nonnullable(), fb(), FRAMEOPTION_END_UNBOUNDED_FOLLOWING, FRAMEOPTION_START_UNBOUNDED_PRECEDING, WindowClause::frameOptions, InvalidOid, IsA, linitial, list_length(), makeNode, memcpy(), MONOTONICFUNC_BOTH, MONOTONICFUNC_DECREASING, MONOTONICFUNC_INCREASING, MONOTONICFUNC_NONE, NIL, NOTNULL_SOURCE_HASHTABLE, PG_GETARG_POINTER, PG_RETURN_POINTER, and SupportRequestWFuncMonotonic::window_clause.

◆ int8larger()

Datum int8larger ( PG_FUNCTION_ARGS  )

Definition at line 875 of file int8.c.

876{
880
881 result = ((arg1 > arg2) ? arg1 : arg2);
882
884}

References fb(), PG_GETARG_INT64, PG_RETURN_INT64, and result.

◆ int8lcm()

Datum int8lcm ( PG_FUNCTION_ARGS  )

Definition at line 691 of file int8.c.

692{
695 int64 gcd;
697
698 /*
699 * Handle lcm(x, 0) = lcm(0, x) = 0 as a special case. This prevents a
700 * division-by-zero error below when x is zero, and an overflow error from
701 * the GCD computation when x = INT64_MIN.
702 */
703 if (arg1 == 0 || arg2 == 0)
705
706 /* lcm(x, y) = abs(x / gcd(x, y) * y) */
708 arg1 = arg1 / gcd;
709
713 errmsg("bigint out of range")));
714
715 /* If the result is INT64_MIN, it cannot be represented. */
719 errmsg("bigint out of range")));
720
721 if (result < 0)
722 result = -result;
723
725}
static uint32 gcd(uint32 a, uint32 b)

References ereport, errcode(), errmsg, ERROR, fb(), gcd(), int8gcd_internal(), PG_GETARG_INT64, PG_INT64_MIN, pg_mul_s64_overflow(), PG_RETURN_INT64, result, and unlikely.

◆ int8le()

Datum int8le ( PG_FUNCTION_ARGS  )

Definition at line 152 of file int8.c.

153{
156
158}

References fb(), PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int8lt()

Datum int8lt ( PG_FUNCTION_ARGS  )

Definition at line 134 of file int8.c.

135{
138
140}

References fb(), PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int8mi()

◆ int8mod()

Datum int8mod ( PG_FUNCTION_ARGS  )

Definition at line 572 of file int8.c.

573{
576
577 if (unlikely(arg2 == 0))
578 {
581 errmsg("division by zero")));
582 /* ensure compiler realizes we mustn't reach the division (gcc bug) */
584 }
585
586 /*
587 * Some machines throw a floating-point exception for INT64_MIN % -1,
588 * which is a bit silly since the correct answer is perfectly
589 * well-defined, namely zero.
590 */
591 if (arg2 == -1)
593
594 /* No overflow is possible */
595
597}

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT64, PG_RETURN_INT64, PG_RETURN_NULL, and unlikely.

◆ int8mul()

Datum int8mul ( PG_FUNCTION_ARGS  )

Definition at line 497 of file int8.c.

498{
502
506 errmsg("bigint out of range")));
508}

References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT64, pg_mul_s64_overflow(), PG_RETURN_INT64, result, and unlikely.

Referenced by int8_to_char().

◆ int8ne()

Datum int8ne ( PG_FUNCTION_ARGS  )

Definition at line 125 of file int8.c.

126{
129
131}

References fb(), PG_GETARG_INT64, and PG_RETURN_BOOL.

◆ int8not()

Datum int8not ( PG_FUNCTION_ARGS  )

Definition at line 1221 of file int8.c.

1222{
1224
1226}

References fb(), PG_GETARG_INT64, and PG_RETURN_INT64.

◆ int8or()

Datum int8or ( PG_FUNCTION_ARGS  )

Definition at line 1203 of file int8.c.

1204{
1207
1209}

References fb(), PG_GETARG_INT64, and PG_RETURN_INT64.

◆ int8out()

Datum int8out ( PG_FUNCTION_ARGS  )

Definition at line 63 of file int8.c.

64{
66 char buf[MAXINT8LEN + 1];
67 char *result;
68 int len;
69
70 len = pg_lltoa(val, buf) + 1;
71
72 /*
73 * Since the length is already known, we do a manual palloc() and memcpy()
74 * to avoid the strlen() call that would otherwise be done in pstrdup().
75 */
76 result = palloc(len);
79}
#define MAXINT8LEN
Definition builtins.h:22
#define PG_RETURN_CSTRING(x)
Definition fmgr.h:364
void * palloc(Size size)
Definition mcxt.c:1390
int pg_lltoa(int64 value, char *a)
Definition numutils.c:1226
const void size_t len
static char buf[DEFAULT_XLOG_SEG_SIZE]

References buf, len, MAXINT8LEN, memcpy(), palloc(), PG_GETARG_INT64, pg_lltoa(), PG_RETURN_CSTRING, result, and val.

Referenced by int8_to_char().

◆ int8pl()

◆ int8recv()

Datum int8recv ( PG_FUNCTION_ARGS  )

Definition at line 85 of file int8.c.

86{
88
90}
int64 pq_getmsgint64(StringInfo msg)
Definition pqformat.c:452
struct StringInfoData * StringInfo
Definition string.h:15

References buf, PG_GETARG_POINTER, PG_RETURN_INT64, and pq_getmsgint64().

◆ int8send()

Datum int8send ( PG_FUNCTION_ARGS  )

Definition at line 96 of file int8.c.

97{
100
104}
#define PG_RETURN_BYTEA_P(x)
Definition fmgr.h:373
void pq_begintypsend(StringInfo buf)
Definition pqformat.c:325
bytea * pq_endtypsend(StringInfo buf)
Definition pqformat.c:345
static void pq_sendint64(StringInfo buf, uint64 i)
Definition pqformat.h:152

References buf, fb(), PG_GETARG_INT64, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint64().

Referenced by int8_bytea().

◆ int8shl()

Datum int8shl ( PG_FUNCTION_ARGS  )

Definition at line 1229 of file int8.c.

1230{
1233
1235}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT64.

◆ int8shr()

Datum int8shr ( PG_FUNCTION_ARGS  )

Definition at line 1238 of file int8.c.

1239{
1242
1244}

References fb(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT64.

◆ int8smaller()

Datum int8smaller ( PG_FUNCTION_ARGS  )

Definition at line 887 of file int8.c.

888{
892
893 result = ((arg1 < arg2) ? arg1 : arg2);
894
896}

References fb(), PG_GETARG_INT64, PG_RETURN_INT64, and result.

◆ int8um()

Datum int8um ( PG_FUNCTION_ARGS  )

Definition at line 447 of file int8.c.

448{
451
452 if (unlikely(arg == PG_INT64_MIN))
455 errmsg("bigint out of range")));
456 result = -arg;
458}

References arg, ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_INT64, PG_INT64_MIN, PG_RETURN_INT64, result, and unlikely.

◆ int8up()

Datum int8up ( PG_FUNCTION_ARGS  )

Definition at line 461 of file int8.c.

462{
464
466}

References arg, PG_GETARG_INT64, and PG_RETURN_INT64.

◆ int8xor()

Datum int8xor ( PG_FUNCTION_ARGS  )

Definition at line 1212 of file int8.c.

1213{
1216
1218}

References fb(), PG_GETARG_INT64, and PG_RETURN_INT64.

◆ oidtoi8()

Datum oidtoi8 ( PG_FUNCTION_ARGS  )

Definition at line 1378 of file int8.c.

1379{
1380 Oid arg = PG_GETARG_OID(0);
1381
1383}
#define PG_GETARG_OID(n)
Definition fmgr.h:275

References arg, PG_GETARG_OID, and PG_RETURN_INT64.

◆ oidtooid8()

Datum oidtooid8 ( PG_FUNCTION_ARGS  )

Definition at line 1386 of file int8.c.

1387{
1388 Oid arg = PG_GETARG_OID(0);
1389
1391}
uint64 Oid8
Definition c.h:756
#define PG_RETURN_OID8(x)
Definition fmgr.h:362

References arg, PG_GETARG_OID, and PG_RETURN_OID8.