Another pgindent run with lib typedefs added.
This commit is contained in:
parent
166300f318
commit
15d3f9f6b7
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.183 2004/08/29 05:06:40 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.184 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, 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/backend/access/transam/xlog.c,v 1.167 2004/08/29 16:34:47 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.168 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2484,9 +2484,9 @@ got_record:;
|
|||||||
/*
|
/*
|
||||||
* Allocate or enlarge readRecordBuf as needed. To avoid useless
|
* Allocate or enlarge readRecordBuf as needed. To avoid useless
|
||||||
* small increases, round its size to a multiple of BLCKSZ, and make
|
* small increases, round its size to a multiple of BLCKSZ, and make
|
||||||
* sure it's at least 4*BLCKSZ to start with. (That is enough for
|
* sure it's at least 4*BLCKSZ to start with. (That is enough for all
|
||||||
* all "normal" records, but very large commit or abort records might
|
* "normal" records, but very large commit or abort records might need
|
||||||
* need more space.)
|
* more space.)
|
||||||
*/
|
*/
|
||||||
if (total_len > readRecordBufSize)
|
if (total_len > readRecordBufSize)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.142 2004/08/29 21:08:47 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.143 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1117,14 +1117,16 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) XLogRecGetData(record);
|
xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) XLogRecGetData(record);
|
||||||
char *dst_path = xlrec->src_path + strlen(xlrec->src_path) + 1;
|
char *dst_path = xlrec->src_path + strlen(xlrec->src_path) + 1;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
char buf[2 * MAXPGPATH + 100];
|
char buf[2 * MAXPGPATH + 100];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Our theory for replaying a CREATE is to forcibly drop the target
|
* Our theory for replaying a CREATE is to forcibly drop the
|
||||||
* subdirectory if present, then re-copy the source data. This
|
* target subdirectory if present, then re-copy the source data.
|
||||||
* may be more work than needed, but it is simple to implement.
|
* This may be more work than needed, but it is simple to
|
||||||
|
* implement.
|
||||||
*/
|
*/
|
||||||
if (stat(dst_path, &st) == 0 && S_ISDIR(st.st_mode))
|
if (stat(dst_path, &st) == 0 && S_ISDIR(st.st_mode))
|
||||||
{
|
{
|
||||||
@ -1135,6 +1137,7 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy this subdirectory to the new location
|
* Copy this subdirectory to the new location
|
||||||
*
|
*
|
||||||
@ -1164,7 +1167,10 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
{
|
{
|
||||||
xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) XLogRecGetData(record);
|
xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) XLogRecGetData(record);
|
||||||
|
|
||||||
/* Drop pages for this database that are in the shared buffer cache */
|
/*
|
||||||
|
* Drop pages for this database that are in the shared buffer
|
||||||
|
* cache
|
||||||
|
*/
|
||||||
DropBuffers(xlrec->db_id);
|
DropBuffers(xlrec->db_id);
|
||||||
|
|
||||||
if (!rmtree(xlrec->dir_path, true))
|
if (!rmtree(xlrec->dir_path, true))
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.10 2004/08/29 21:08:47 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.11 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -444,7 +444,8 @@ DropTableSpace(DropTableSpaceStmt *stmt)
|
|||||||
tablespacename);
|
tablespacename);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the pg_tablespace tuple (this will roll back if we fail below)
|
* Remove the pg_tablespace tuple (this will roll back if we fail
|
||||||
|
* below)
|
||||||
*/
|
*/
|
||||||
simple_heap_delete(rel, &tuple->t_self);
|
simple_heap_delete(rel, &tuple->t_self);
|
||||||
|
|
||||||
@ -598,8 +599,8 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
|
|||||||
/*
|
/*
|
||||||
* Okay, try to remove the symlink. We must however deal with the
|
* Okay, try to remove the symlink. We must however deal with the
|
||||||
* possibility that it's a directory instead of a symlink --- this
|
* possibility that it's a directory instead of a symlink --- this
|
||||||
* could happen during WAL replay (see TablespaceCreateDbspace),
|
* could happen during WAL replay (see TablespaceCreateDbspace), and
|
||||||
* and it is also the normal case on Windows.
|
* it is also the normal case on Windows.
|
||||||
*/
|
*/
|
||||||
if (lstat(location, &st) == 0 && S_ISDIR(st.st_mode))
|
if (lstat(location, &st) == 0 && S_ISDIR(st.st_mode))
|
||||||
{
|
{
|
||||||
@ -959,8 +960,8 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
|
|||||||
char *linkloc;
|
char *linkloc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to coerce target directory to safe permissions. If this
|
* Attempt to coerce target directory to safe permissions. If
|
||||||
* fails, it doesn't exist or has the wrong owner.
|
* this fails, it doesn't exist or has the wrong owner.
|
||||||
*/
|
*/
|
||||||
if (chmod(location, 0700) != 0)
|
if (chmod(location, 0700) != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.289 2004/08/29 05:06:41 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.290 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1704,10 +1704,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
|
|||||||
if (!(tuple.t_data->t_infomask & HEAP_XMIN_COMMITTED))
|
if (!(tuple.t_data->t_infomask & HEAP_XMIN_COMMITTED))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* There cannot be another concurrently running VACUUM.
|
* There cannot be another concurrently running VACUUM. If
|
||||||
* If the tuple had been moved in by a previous VACUUM,
|
* the tuple had been moved in by a previous VACUUM, the
|
||||||
* the visibility check would have set XMIN_COMMITTED. If
|
* visibility check would have set XMIN_COMMITTED. If the
|
||||||
* the tuple had been moved in by the currently running
|
* tuple had been moved in by the currently running
|
||||||
* VACUUM, the loop would have been terminated. We had
|
* VACUUM, the loop would have been terminated. We had
|
||||||
* elog(ERROR, ...) here, but as we are testing for a
|
* elog(ERROR, ...) here, but as we are testing for a
|
||||||
* can't-happen condition, Assert() seems more
|
* can't-happen condition, Assert() seems more
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.101 2004/08/29 05:06:41 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.102 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -270,6 +270,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
|
|||||||
CStringGetDatum(val),
|
CStringGetDatum(val),
|
||||||
ObjectIdGetDatum(InvalidOid),
|
ObjectIdGetDatum(InvalidOid),
|
||||||
Int32GetDatum(-1)));
|
Int32GetDatum(-1)));
|
||||||
|
|
||||||
pfree(val);
|
pfree(val);
|
||||||
if (interval->month != 0)
|
if (interval->month != 0)
|
||||||
{
|
{
|
||||||
@ -284,6 +285,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
|
|||||||
{
|
{
|
||||||
/* Here we change from SQL to Unix sign convention */
|
/* Here we change from SQL to Unix sign convention */
|
||||||
CTimeZone = -interval->time;
|
CTimeZone = -interval->time;
|
||||||
|
|
||||||
HasCTZSet = true;
|
HasCTZSet = true;
|
||||||
}
|
}
|
||||||
pfree(interval);
|
pfree(interval);
|
||||||
@ -450,8 +452,8 @@ show_timezone(void)
|
|||||||
{
|
{
|
||||||
Interval interval;
|
Interval interval;
|
||||||
|
|
||||||
interval.month = 0;
|
interval. month = 0;
|
||||||
interval.time = -CTimeZone;
|
interval. time = -CTimeZone;
|
||||||
|
|
||||||
tzn = DatumGetCString(DirectFunctionCall1(interval_out,
|
tzn = DatumGetCString(DirectFunctionCall1(interval_out,
|
||||||
IntervalPGetDatum(&interval)));
|
IntervalPGetDatum(&interval)));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.174 2004/08/29 05:06:44 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.175 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -431,8 +431,8 @@ preprocess_expression(Query *parse, Node *expr, int kind)
|
|||||||
/*
|
/*
|
||||||
* If it's a qual or havingQual, convert it to implicit-AND format.
|
* If it's a qual or havingQual, convert it to implicit-AND format.
|
||||||
* (We don't want to do this before eval_const_expressions, since the
|
* (We don't want to do this before eval_const_expressions, since the
|
||||||
* latter would be unable to simplify a top-level AND correctly.
|
* latter would be unable to simplify a top-level AND correctly. Also,
|
||||||
* Also, SS_process_sublinks expects explicit-AND format.)
|
* SS_process_sublinks expects explicit-AND format.)
|
||||||
*/
|
*/
|
||||||
if (kind == EXPRKIND_QUAL)
|
if (kind == EXPRKIND_QUAL)
|
||||||
expr = (Node *) make_ands_implicit((Expr *) expr);
|
expr = (Node *) make_ands_implicit((Expr *) expr);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.4 2004/08/29 05:06:46 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.5 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.30 2004/08/29 05:06:48 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.31 2004/08/30 02:54:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -237,7 +237,6 @@ tas_dummy() /* really means: extern int tas(slock_t
|
|||||||
asm("nop");
|
asm("nop");
|
||||||
}
|
}
|
||||||
#endif /* __sparc || __sparc__ */
|
#endif /* __sparc || __sparc__ */
|
||||||
|
|
||||||
#endif /* not __GNUC__ */
|
#endif /* not __GNUC__ */
|
||||||
#endif /* HAVE_SPINLOCKS */
|
#endif /* HAVE_SPINLOCKS */
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.110 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.111 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -737,9 +737,9 @@ mdsync(void)
|
|||||||
* may seem a bit unclean -- md calling smgr? But it's really
|
* may seem a bit unclean -- md calling smgr? But it's really
|
||||||
* the best solution. It ensures that the open file reference
|
* the best solution. It ensures that the open file reference
|
||||||
* isn't permanently leaked if we get an error here. (You may
|
* isn't permanently leaked if we get an error here. (You may
|
||||||
* say "but an unreferenced SMgrRelation is still a leak!"
|
* say "but an unreferenced SMgrRelation is still a leak!" Not
|
||||||
* Not really, because the only case in which a checkpoint is
|
* really, because the only case in which a checkpoint is done
|
||||||
* done by a process that isn't about to shut down is in the
|
* by a process that isn't about to shut down is in the
|
||||||
* bgwriter, and it will periodically do smgrcloseall(). This
|
* bgwriter, and it will periodically do smgrcloseall(). This
|
||||||
* fact justifies our not closing the reln in the success path
|
* fact justifies our not closing the reln in the success path
|
||||||
* either, which is a good thing since in non-bgwriter cases
|
* either, which is a good thing since in non-bgwriter cases
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.80 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.81 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -339,8 +339,8 @@ smgrcreate(SMgrRelation reln, bool isTemp, bool isRedo)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a non-transactional XLOG entry showing the file creation.
|
* Make a non-transactional XLOG entry showing the file creation. It's
|
||||||
* It's non-transactional because we should replay it whether the
|
* non-transactional because we should replay it whether the
|
||||||
* transaction commits or not; if not, the file will be dropped at
|
* transaction commits or not; if not, the file will be dropped at
|
||||||
* abort time.
|
* abort time.
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.102 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.103 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ date_out(PG_FUNCTION_ARGS)
|
|||||||
*tm = &tt;
|
*tm = &tt;
|
||||||
char buf[MAXDATELEN + 1];
|
char buf[MAXDATELEN + 1];
|
||||||
|
|
||||||
j2date(date + POSTGRES_EPOCH_JDATE,
|
j2date(date +POSTGRES_EPOCH_JDATE,
|
||||||
&(tm->tm_year), &(tm->tm_mon), &(tm->tm_mday));
|
&(tm->tm_year), &(tm->tm_mon), &(tm->tm_mday));
|
||||||
|
|
||||||
EncodeDateOnly(tm, DateStyle, buf);
|
EncodeDateOnly(tm, DateStyle, buf);
|
||||||
@ -726,7 +726,7 @@ timestamp_date(PG_FUNCTION_ARGS)
|
|||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -769,7 +769,7 @@ timestamptz_date(PG_FUNCTION_ARGS)
|
|||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -1331,7 +1331,7 @@ timestamp_time(PG_FUNCTION_ARGS)
|
|||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -1368,7 +1368,7 @@ timestamptz_time(PG_FUNCTION_ARGS)
|
|||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -2246,7 +2246,7 @@ timestamptz_timetz(PG_FUNCTION_ARGS)
|
|||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -2273,10 +2273,10 @@ datetimetz_timestamptz(PG_FUNCTION_ARGS)
|
|||||||
TimestampTz result;
|
TimestampTz result;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result = (((date * INT64CONST(86400000000)) + time->time)
|
result = (((date *INT64CONST(86400000000)) +time->time)
|
||||||
+ (time->zone * INT64CONST(1000000)));
|
+ (time->zone * INT64CONST(1000000)));
|
||||||
#else
|
#else
|
||||||
result = (((date * 86400.0) + time->time) + time->zone);
|
result = (((date *86400.0) +time->time) + time->zone);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PG_RETURN_TIMESTAMP(result);
|
PG_RETURN_TIMESTAMP(result);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.133 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.134 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -666,6 +666,7 @@ j2day(int date)
|
|||||||
unsigned int day;
|
unsigned int day;
|
||||||
|
|
||||||
day = date;
|
day = date;
|
||||||
|
|
||||||
day += 1;
|
day += 1;
|
||||||
day %= 7;
|
day %= 7;
|
||||||
|
|
||||||
@ -1585,7 +1586,7 @@ int
|
|||||||
DetermineLocalTimeZone(struct pg_tm * tm)
|
DetermineLocalTimeZone(struct pg_tm * tm)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
int date,
|
int date ,
|
||||||
sec;
|
sec;
|
||||||
pg_time_t day,
|
pg_time_t day,
|
||||||
mysec,
|
mysec,
|
||||||
@ -1609,7 +1610,8 @@ DetermineLocalTimeZone(struct pg_tm * tm)
|
|||||||
if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday))
|
if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday))
|
||||||
goto overflow;
|
goto overflow;
|
||||||
date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - UNIX_EPOCH_JDATE;
|
date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - UNIX_EPOCH_JDATE;
|
||||||
day = ((pg_time_t) date) * 86400;
|
|
||||||
|
day = ((pg_time_t) date) *86400;
|
||||||
if (day / 86400 != date)
|
if (day / 86400 != date)
|
||||||
goto overflow;
|
goto overflow;
|
||||||
sec = tm->tm_sec + (tm->tm_min + tm->tm_hour * 60) * 60;
|
sec = tm->tm_sec + (tm->tm_min + tm->tm_hour * 60) * 60;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
* formatting.c
|
* formatting.c
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.77 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.78 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1999-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1999-2004, PostgreSQL Global Development Group
|
||||||
@ -3556,6 +3556,7 @@ NUM_prepare_locale(NUMProc *Np)
|
|||||||
*/
|
*/
|
||||||
if (lconv->decimal_point && *lconv->decimal_point)
|
if (lconv->decimal_point && *lconv->decimal_point)
|
||||||
Np->decimal = lconv->decimal_point;
|
Np->decimal = lconv->decimal_point;
|
||||||
|
|
||||||
else
|
else
|
||||||
Np->decimal = ".";
|
Np->decimal = ".";
|
||||||
|
|
||||||
@ -3579,6 +3580,7 @@ NUM_prepare_locale(NUMProc *Np)
|
|||||||
Np->L_negative_sign = "-";
|
Np->L_negative_sign = "-";
|
||||||
Np->L_positive_sign = "+";
|
Np->L_positive_sign = "+";
|
||||||
Np->decimal = ".";
|
Np->decimal = ".";
|
||||||
|
|
||||||
Np->L_thousands_sep = ",";
|
Np->L_thousands_sep = ",";
|
||||||
Np->L_currency_symbol = " ";
|
Np->L_currency_symbol = " ";
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.125 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.126 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -816,6 +816,7 @@ tintervalin(PG_FUNCTION_ARGS)
|
|||||||
t2;
|
t2;
|
||||||
|
|
||||||
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
||||||
|
|
||||||
if (istinterval(intervalstr, &t1, &t2) == 0)
|
if (istinterval(intervalstr, &t1, &t2) == 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
@ -823,14 +824,15 @@ tintervalin(PG_FUNCTION_ARGS)
|
|||||||
intervalstr)));
|
intervalstr)));
|
||||||
|
|
||||||
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
|
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
|
||||||
interval->status = T_INTERVAL_INVAL; /* undefined */
|
interval ->status = T_INTERVAL_INVAL; /* undefined */
|
||||||
|
|
||||||
else
|
else
|
||||||
interval->status = T_INTERVAL_VALID;
|
interval ->status = T_INTERVAL_VALID;
|
||||||
|
|
||||||
i_start = ABSTIMEMIN(t1, t2);
|
i_start = ABSTIMEMIN(t1, t2);
|
||||||
i_end = ABSTIMEMAX(t1, t2);
|
i_end = ABSTIMEMAX(t1, t2);
|
||||||
interval->data[0] = i_start;
|
interval ->data[0] = i_start;
|
||||||
interval->data[1] = i_end;
|
interval ->data[1] = i_end;
|
||||||
|
|
||||||
PG_RETURN_TIMEINTERVAL(interval);
|
PG_RETURN_TIMEINTERVAL(interval);
|
||||||
}
|
}
|
||||||
@ -877,15 +879,16 @@ tintervalrecv(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
||||||
|
|
||||||
interval->status = pq_getmsgint(buf, sizeof(interval->status));
|
interval ->status = pq_getmsgint(buf, sizeof(interval->status));
|
||||||
|
|
||||||
if (!(interval->status == T_INTERVAL_INVAL ||
|
if (!(interval->status == T_INTERVAL_INVAL ||
|
||||||
interval->status == T_INTERVAL_VALID))
|
interval->status == T_INTERVAL_VALID))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
|
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
|
||||||
errmsg("invalid status in external \"tinterval\" value")));
|
errmsg("invalid status in external \"tinterval\" value")));
|
||||||
|
|
||||||
interval->data[0] = pq_getmsgint(buf, sizeof(interval->data[0]));
|
interval ->data[0] = pq_getmsgint(buf, sizeof(interval->data[0]));
|
||||||
interval->data[1] = pq_getmsgint(buf, sizeof(interval->data[1]));
|
interval ->data[1] = pq_getmsgint(buf, sizeof(interval->data[1]));
|
||||||
|
|
||||||
PG_RETURN_TIMEINTERVAL(interval);
|
PG_RETURN_TIMEINTERVAL(interval);
|
||||||
}
|
}
|
||||||
@ -931,7 +934,7 @@ interval_reltime(PG_FUNCTION_ARGS)
|
|||||||
year = 0;
|
year = 0;
|
||||||
month = 0;
|
month = 0;
|
||||||
}
|
}
|
||||||
else if (abs(interval->month) >= 12)
|
else if (abs(interval->month) >=12)
|
||||||
{
|
{
|
||||||
year = (interval->month / 12);
|
year = (interval->month / 12);
|
||||||
month = (interval->month % 12);
|
month = (interval->month % 12);
|
||||||
@ -1016,12 +1019,13 @@ mktinterval(PG_FUNCTION_ARGS)
|
|||||||
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
||||||
|
|
||||||
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
|
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
|
||||||
interval->status = T_INTERVAL_INVAL;
|
interval ->status = T_INTERVAL_INVAL;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
interval->status = T_INTERVAL_VALID;
|
interval ->status = T_INTERVAL_VALID;
|
||||||
interval->data[0] = tstart;
|
interval ->data[0] = tstart;
|
||||||
interval->data[1] = tend;
|
interval ->data[1] = tend;
|
||||||
}
|
}
|
||||||
|
|
||||||
PG_RETURN_TIMEINTERVAL(interval);
|
PG_RETURN_TIMEINTERVAL(interval);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* Copyright (c) 1998-2004, PostgreSQL Global Development Group
|
* Copyright (c) 1998-2004, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.78 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.79 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -462,7 +462,7 @@ numeric_send(PG_FUNCTION_ARGS)
|
|||||||
* scale of the attribute have to be applied on the value.
|
* scale of the attribute have to be applied on the value.
|
||||||
*/
|
*/
|
||||||
Datum
|
Datum
|
||||||
numeric(PG_FUNCTION_ARGS)
|
numeric (PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
Numeric num = PG_GETARG_NUMERIC(0);
|
Numeric num = PG_GETARG_NUMERIC(0);
|
||||||
int32 typmod = PG_GETARG_INT32(1);
|
int32 typmod = PG_GETARG_INT32(1);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.164 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.165 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2755,7 +2755,7 @@ convert_timevalue_to_scalar(Datum value, Oid typid)
|
|||||||
return (interval->time + (interval->month * ((365.25 / 12.0) * 86400000000.0)));
|
return (interval->time + (interval->month * ((365.25 / 12.0) * 86400000000.0)));
|
||||||
#else
|
#else
|
||||||
return interval->time +
|
return interval->time +
|
||||||
interval->month * (365.25 / 12.0 * 24.0 * 60.0 * 60.0);
|
interval ->month * (365.25 / 12.0 * 24.0 * 60.0 * 60.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
case RELTIMEOID:
|
case RELTIMEOID:
|
||||||
@ -2770,7 +2770,7 @@ convert_timevalue_to_scalar(Datum value, Oid typid)
|
|||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
if (interval->status != 0)
|
if (interval->status != 0)
|
||||||
return ((interval->data[1] - interval->data[0]) * 1000000.0);
|
return ((interval->data[1] - interval->data[0]) *1000000.0);
|
||||||
#else
|
#else
|
||||||
if (interval->status != 0)
|
if (interval->status != 0)
|
||||||
return interval->data[1] - interval->data[0];
|
return interval->data[1] - interval->data[0];
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.112 2004/08/29 05:06:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.113 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -173,6 +173,7 @@ timestamp_recv(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
timestamp = (Timestamp) pq_getmsgint64(buf);
|
timestamp = (Timestamp) pq_getmsgint64(buf);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
timestamp = (Timestamp) pq_getmsgfloat8(buf);
|
timestamp = (Timestamp) pq_getmsgfloat8(buf);
|
||||||
#endif
|
#endif
|
||||||
@ -180,7 +181,7 @@ timestamp_recv(PG_FUNCTION_ARGS)
|
|||||||
/* rangecheck: see if timestamp_out would like it */
|
/* rangecheck: see if timestamp_out would like it */
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
/* ok */ ;
|
/* ok */ ;
|
||||||
else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -416,6 +417,7 @@ timestamptz_recv(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
timestamp = (TimestampTz) pq_getmsgint64(buf);
|
timestamp = (TimestampTz) pq_getmsgint64(buf);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
timestamp = (TimestampTz) pq_getmsgfloat8(buf);
|
timestamp = (TimestampTz) pq_getmsgfloat8(buf);
|
||||||
#endif
|
#endif
|
||||||
@ -423,7 +425,7 @@ timestamptz_recv(PG_FUNCTION_ARGS)
|
|||||||
/* rangecheck: see if timestamptz_out would like it */
|
/* rangecheck: see if timestamptz_out would like it */
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
/* ok */ ;
|
/* ok */ ;
|
||||||
else if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
else if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -577,11 +579,12 @@ interval_recv(PG_FUNCTION_ARGS)
|
|||||||
interval = (Interval *) palloc(sizeof(Interval));
|
interval = (Interval *) palloc(sizeof(Interval));
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
interval->time = pq_getmsgint64(buf);
|
interval ->time = pq_getmsgint64(buf);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
interval->time = pq_getmsgfloat8(buf);
|
interval ->time = pq_getmsgfloat8(buf);
|
||||||
#endif
|
#endif
|
||||||
interval->month = pq_getmsgint(buf, sizeof(interval->month));
|
interval ->month = pq_getmsgint(buf, sizeof(interval->month));
|
||||||
|
|
||||||
PG_RETURN_INTERVAL_P(interval);
|
PG_RETURN_INTERVAL_P(interval);
|
||||||
}
|
}
|
||||||
@ -676,25 +679,28 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
}
|
}
|
||||||
else if (range == INTERVAL_MASK(YEAR))
|
else if (range == INTERVAL_MASK(YEAR))
|
||||||
{
|
{
|
||||||
interval->month = ((interval->month / 12) * 12);
|
interval ->month = ((interval->month / 12) *12);
|
||||||
interval->time = 0;
|
interval ->time = 0;
|
||||||
}
|
}
|
||||||
else if (range == INTERVAL_MASK(MONTH))
|
else if (range == INTERVAL_MASK(MONTH))
|
||||||
{
|
{
|
||||||
interval->month %= 12;
|
interval ->month %= 12;
|
||||||
interval->time = 0;
|
interval ->time = 0;
|
||||||
}
|
}
|
||||||
/* YEAR TO MONTH */
|
/* YEAR TO MONTH */
|
||||||
else if (range == (INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH)))
|
else if (range == (INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH)))
|
||||||
interval->time = 0;
|
interval ->time = 0;
|
||||||
|
|
||||||
else if (range == INTERVAL_MASK(DAY))
|
else if (range == INTERVAL_MASK(DAY))
|
||||||
{
|
{
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
interval->time = (((int) (interval->time / INT64CONST(86400000000)))
|
interval ->time = (((int) (interval->time / INT64CONST(86400000000)))
|
||||||
* INT64CONST(86400000000));
|
* INT64CONST(86400000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
interval->time = (((int) (interval->time / 86400)) * 86400);
|
interval ->time = (((int) (interval->time / 86400)) * 86400);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (range == INTERVAL_MASK(HOUR))
|
else if (range == INTERVAL_MASK(HOUR))
|
||||||
@ -706,15 +712,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
double day;
|
double day;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
day = (interval->time / INT64CONST(86400000000));
|
day = (interval->time / INT64CONST(86400000000));
|
||||||
interval->time -= (day * INT64CONST(86400000000));
|
interval ->time -= (day * INT64CONST(86400000000));
|
||||||
interval->time = ((interval->time / INT64CONST(3600000000))
|
interval ->time = ((interval->time / INT64CONST(3600000000))
|
||||||
* INT64CONST(3600000000));
|
*INT64CONST(3600000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
TMODULO(interval->time, day, 86400.0);
|
TMODULO(interval->time, day, 86400.0);
|
||||||
interval->time = (((int) (interval->time / 3600)) * 3600.0);
|
interval ->time = (((int) (interval->time / 3600)) * 3600.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (range == INTERVAL_MASK(MINUTE))
|
else if (range == INTERVAL_MASK(MINUTE))
|
||||||
@ -726,15 +734,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
double hour;
|
double hour;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
hour = (interval->time / INT64CONST(3600000000));
|
hour = (interval->time / INT64CONST(3600000000));
|
||||||
interval->time -= (hour * INT64CONST(3600000000));
|
interval ->time -= (hour * INT64CONST(3600000000));
|
||||||
interval->time = ((interval->time / INT64CONST(60000000))
|
interval ->time = ((interval->time / INT64CONST(60000000))
|
||||||
* INT64CONST(60000000));
|
*INT64CONST(60000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
TMODULO(interval->time, hour, 3600.0);
|
TMODULO(interval->time, hour, 3600.0);
|
||||||
interval->time = (((int) (interval->time / 60)) * 60);
|
interval ->time = (((int) (interval->time / 60)) * 60);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (range == INTERVAL_MASK(SECOND))
|
else if (range == INTERVAL_MASK(SECOND))
|
||||||
@ -746,10 +756,12 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
double minute;
|
double minute;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
minute = (interval->time / INT64CONST(60000000));
|
minute = (interval->time / INT64CONST(60000000));
|
||||||
interval->time -= (minute * INT64CONST(60000000));
|
interval ->time -= (minute * INT64CONST(60000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
TMODULO(interval->time, minute, 60.0);
|
TMODULO(interval->time, minute, 60.0);
|
||||||
/* interval->time = (int)(interval->time); */
|
/* interval->time = (int)(interval->time); */
|
||||||
@ -759,12 +771,14 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
else if (range == (INTERVAL_MASK(DAY) |
|
else if (range == (INTERVAL_MASK(DAY) |
|
||||||
INTERVAL_MASK(HOUR)))
|
INTERVAL_MASK(HOUR)))
|
||||||
{
|
{
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
interval->time = ((interval->time / INT64CONST(3600000000))
|
interval ->time = ((interval->time / INT64CONST(3600000000))
|
||||||
* INT64CONST(3600000000));
|
*INT64CONST(3600000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
interval->time = (((int) (interval->time / 3600)) * 3600);
|
interval ->time = (((int) (interval->time / 3600)) * 3600);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* DAY TO MINUTE */
|
/* DAY TO MINUTE */
|
||||||
@ -772,12 +786,14 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
INTERVAL_MASK(HOUR) |
|
INTERVAL_MASK(HOUR) |
|
||||||
INTERVAL_MASK(MINUTE)))
|
INTERVAL_MASK(MINUTE)))
|
||||||
{
|
{
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
interval->time = ((interval->time / INT64CONST(60000000))
|
interval ->time = ((interval->time / INT64CONST(60000000))
|
||||||
* INT64CONST(60000000));
|
*INT64CONST(60000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
interval->time = (((int) (interval->time / 60)) * 60);
|
interval ->time = (((int) (interval->time / 60)) * 60);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* DAY TO SECOND */
|
/* DAY TO SECOND */
|
||||||
@ -785,7 +801,8 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
INTERVAL_MASK(HOUR) |
|
INTERVAL_MASK(HOUR) |
|
||||||
INTERVAL_MASK(MINUTE) |
|
INTERVAL_MASK(MINUTE) |
|
||||||
INTERVAL_MASK(SECOND)))
|
INTERVAL_MASK(SECOND)))
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
/* HOUR TO MINUTE */
|
/* HOUR TO MINUTE */
|
||||||
else if (range == (INTERVAL_MASK(HOUR) |
|
else if (range == (INTERVAL_MASK(HOUR) |
|
||||||
INTERVAL_MASK(MINUTE)))
|
INTERVAL_MASK(MINUTE)))
|
||||||
@ -797,15 +814,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
double day;
|
double day;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
day = (interval->time / INT64CONST(86400000000));
|
day = (interval->time / INT64CONST(86400000000));
|
||||||
interval->time -= (day * INT64CONST(86400000000));
|
interval ->time -= (day * INT64CONST(86400000000));
|
||||||
interval->time = ((interval->time / INT64CONST(60000000))
|
interval ->time = ((interval->time / INT64CONST(60000000))
|
||||||
* INT64CONST(60000000));
|
*INT64CONST(60000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
TMODULO(interval->time, day, 86400.0);
|
TMODULO(interval->time, day, 86400.0);
|
||||||
interval->time = (((int) (interval->time / 60)) * 60);
|
interval ->time = (((int) (interval->time / 60)) * 60);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* HOUR TO SECOND */
|
/* HOUR TO SECOND */
|
||||||
@ -820,10 +839,12 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
double day;
|
double day;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
day = (interval->time / INT64CONST(86400000000));
|
day = (interval->time / INT64CONST(86400000000));
|
||||||
interval->time -= (day * INT64CONST(86400000000));
|
interval ->time -= (day * INT64CONST(86400000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
TMODULO(interval->time, day, 86400.0);
|
TMODULO(interval->time, day, 86400.0);
|
||||||
#endif
|
#endif
|
||||||
@ -839,10 +860,12 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
double hour;
|
double hour;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interval->month = 0;
|
interval ->month = 0;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
hour = (interval->time / INT64CONST(3600000000));
|
hour = (interval->time / INT64CONST(3600000000));
|
||||||
interval->time -= (hour * INT64CONST(3600000000));
|
interval ->time -= (hour * INT64CONST(3600000000));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
TMODULO(interval->time, hour, 3600.0);
|
TMODULO(interval->time, hour, 3600.0);
|
||||||
#endif
|
#endif
|
||||||
@ -870,16 +893,16 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
|
|||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
if (interval->time >= INT64CONST(0))
|
if (interval->time >= INT64CONST(0))
|
||||||
{
|
{
|
||||||
interval->time = (((interval->time + IntervalOffsets[precision]) / IntervalScales[precision])
|
interval ->time = (((interval->time + IntervalOffsets[precision]) /IntervalScales[precision])
|
||||||
* IntervalScales[precision]);
|
* IntervalScales[precision]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
interval->time = -(((-interval->time + IntervalOffsets[precision]) / IntervalScales[precision])
|
interval ->time = -(((-interval->time + IntervalOffsets[precision]) /IntervalScales[precision])
|
||||||
* IntervalScales[precision]);
|
* IntervalScales[precision]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
interval->time = (rint(((double) interval->time) * IntervalScales[precision])
|
interval ->time = (rint(((double) interval->time) *IntervalScales[precision])
|
||||||
/ IntervalScales[precision]);
|
/ IntervalScales[precision]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -988,7 +1011,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, char **tzn
|
|||||||
if (time < INT64CONST(0))
|
if (time < INT64CONST(0))
|
||||||
{
|
{
|
||||||
time += INT64CONST(86400000000);
|
time += INT64CONST(86400000000);
|
||||||
date -= 1;
|
date -=1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
TMODULO(time, date, 86400e0);
|
TMODULO(time, date, 86400e0);
|
||||||
@ -996,15 +1019,15 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, char **tzn
|
|||||||
if (time < 0)
|
if (time < 0)
|
||||||
{
|
{
|
||||||
time += 86400;
|
time += 86400;
|
||||||
date -= 1;
|
date -=1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* add offset to go from J2000 back to standard Julian date */
|
/* add offset to go from J2000 back to standard Julian date */
|
||||||
date += POSTGRES_EPOCH_JDATE;
|
date +=POSTGRES_EPOCH_JDATE;
|
||||||
|
|
||||||
/* Julian day routine does not work for negative Julian days */
|
/* Julian day routine does not work for negative Julian days */
|
||||||
if (date < 0 || date > (Timestamp) INT_MAX)
|
if (date <0 || date >(Timestamp) INT_MAX)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
j2date((int) date, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
|
j2date((int) date, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
|
||||||
@ -1113,17 +1136,18 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - POSTGRES_EPOCH_JDATE;
|
date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - POSTGRES_EPOCH_JDATE;
|
||||||
|
|
||||||
time = time2t(tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
|
time = time2t(tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
*result = (date * INT64CONST(86400000000)) + time;
|
*result = (date *INT64CONST(86400000000)) +time;
|
||||||
/* check for major overflow */
|
/* check for major overflow */
|
||||||
if ((*result - time) / INT64CONST(86400000000) != date)
|
if ((*result - time) / INT64CONST(86400000000) != date)
|
||||||
return -1;
|
return -1;
|
||||||
/* check for just-barely overflow (okay except time-of-day wraps) */
|
/* check for just-barely overflow (okay except time-of-day wraps) */
|
||||||
if ((*result < 0) ? (date >= 0) : (date < 0))
|
if ((*result < 0) ? (date >=0) : (date <0))
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
*result = ((date * 86400) + time);
|
*result = ((date *86400) +time);
|
||||||
#endif
|
#endif
|
||||||
if (tzp != NULL)
|
if (tzp != NULL)
|
||||||
*result = dt2local(*result, -(*tzp));
|
*result = dt2local(*result, -(*tzp));
|
||||||
@ -1890,6 +1914,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
result = timestamp;
|
result = timestamp;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (span->month != 0)
|
if (span->month != 0)
|
||||||
@ -1898,7 +1923,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
|
|||||||
*tm = &tt;
|
*tm = &tt;
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -1919,13 +1944,13 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
|
|||||||
if (tm->tm_mday > day_tab[isleap(tm->tm_year)][tm->tm_mon - 1])
|
if (tm->tm_mday > day_tab[isleap(tm->tm_year)][tm->tm_mon - 1])
|
||||||
tm->tm_mday = (day_tab[isleap(tm->tm_year)][tm->tm_mon - 1]);
|
tm->tm_mday = (day_tab[isleap(tm->tm_year)][tm->tm_mon - 1]);
|
||||||
|
|
||||||
if (tm2timestamp(tm, fsec, NULL, ×tamp) != 0)
|
if (tm2timestamp(tm, fsec, NULL, ×tamp) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp += span->time;
|
timestamp +=span->time;
|
||||||
result = timestamp;
|
result = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1968,6 +1993,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
result = timestamp;
|
result = timestamp;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (span->month != 0)
|
if (span->month != 0)
|
||||||
@ -1976,7 +2002,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
|
|||||||
*tm = &tt;
|
*tm = &tt;
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
|
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -1999,13 +2025,13 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
tz = DetermineLocalTimeZone(tm);
|
tz = DetermineLocalTimeZone(tm);
|
||||||
|
|
||||||
if (tm2timestamp(tm, fsec, &tz, ×tamp) != 0)
|
if (tm2timestamp(tm, fsec, &tz, ×tamp) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp += span->time;
|
timestamp +=span->time;
|
||||||
result = timestamp;
|
result = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2714,7 +2740,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (type == UNITS)
|
if (type == UNITS)
|
||||||
{
|
{
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -2833,7 +2859,7 @@ timestamptz_trunc(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (type == UNITS)
|
if (type == UNITS)
|
||||||
{
|
{
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3200,7 +3226,7 @@ timestamp_part(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (type == UNITS)
|
if (type == UNITS)
|
||||||
{
|
{
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3279,9 +3305,9 @@ timestamp_part(PG_FUNCTION_ARGS)
|
|||||||
case DTK_CENTURY:
|
case DTK_CENTURY:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* centuries AD, c>0: year in [ (c-1)*100+1 : c*100
|
* centuries AD, c>0: year in [ (c-1)*100+1 : c*100 ]
|
||||||
* ] centuries BC, c<0: year in [ c*100 :
|
* centuries BC, c<0: year in [ c*100 : (c+1)*100-1
|
||||||
* (c+1)*100-1 ] there is no number 0 century.
|
* ] there is no number 0 century.
|
||||||
*/
|
*/
|
||||||
if (tm->tm_year > 0)
|
if (tm->tm_year > 0)
|
||||||
result = ((tm->tm_year + 99) / 100);
|
result = ((tm->tm_year + 99) / 100);
|
||||||
@ -3333,7 +3359,7 @@ timestamp_part(PG_FUNCTION_ARGS)
|
|||||||
* convert to timestamptz to produce consistent
|
* convert to timestamptz to produce consistent
|
||||||
* results
|
* results
|
||||||
*/
|
*/
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3353,7 +3379,7 @@ timestamp_part(PG_FUNCTION_ARGS)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DTK_DOW:
|
case DTK_DOW:
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3361,7 +3387,7 @@ timestamp_part(PG_FUNCTION_ARGS)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DTK_DOY:
|
case DTK_DOY:
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3424,7 +3450,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (type == UNITS)
|
if (type == UNITS)
|
||||||
{
|
{
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3548,14 +3574,14 @@ timestamptz_part(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
case DTK_EPOCH:
|
case DTK_EPOCH:
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result = ((timestamp - SetEpochTimestamp()) / 1000000e0);
|
result = ((timestamp -SetEpochTimestamp()) /1000000e0);
|
||||||
#else
|
#else
|
||||||
result = timestamp - SetEpochTimestamp();
|
result = timestamp -SetEpochTimestamp();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTK_DOW:
|
case DTK_DOW:
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3563,7 +3589,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DTK_DOY:
|
case DTK_DOY:
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3827,9 +3853,10 @@ timestamp2timestamptz(Timestamp timestamp)
|
|||||||
|
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
result = timestamp;
|
result = timestamp;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
|
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
@ -3861,9 +3888,10 @@ timestamptz_timestamp(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
result = timestamp;
|
result = timestamp;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
|
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("timestamp out of range")));
|
errmsg("timestamp out of range")));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.82 2004/08/29 04:12:53 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.83 2004/08/30 02:54:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -300,7 +300,10 @@ fmgr_info_C_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
|
|||||||
*probinstring;
|
*probinstring;
|
||||||
void *libraryhandle;
|
void *libraryhandle;
|
||||||
|
|
||||||
/* Get prosrc and probin strings (link symbol and library filename) */
|
/*
|
||||||
|
* Get prosrc and probin strings (link symbol and library
|
||||||
|
* filename)
|
||||||
|
*/
|
||||||
prosrcattr = SysCacheGetAttr(PROCOID, procedureTuple,
|
prosrcattr = SysCacheGetAttr(PROCOID, procedureTuple,
|
||||||
Anum_pg_proc_prosrc, &isnull);
|
Anum_pg_proc_prosrc, &isnull);
|
||||||
if (isnull)
|
if (isnull)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* 1999/1/15 Tatsuo Ishii
|
* 1999/1/15 Tatsuo Ishii
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c,v 1.4 2003/11/29 22:40:08 pgsql Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c,v 1.5 2004/08/30 02:54:40 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* can be used in either frontend or backend */
|
/* can be used in either frontend or backend */
|
||||||
@ -205,7 +205,7 @@ static unsigned short b2c3[][2] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short BinarySearchRange
|
static unsigned short BinarySearchRange
|
||||||
(codes_t * array, int high, unsigned short code)
|
(codes_t *array, int high, unsigned short code)
|
||||||
{
|
{
|
||||||
int low,
|
int low,
|
||||||
mid,
|
mid,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.9 2004/08/29 04:12:58 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.10 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.234 2004/08/29 05:06:51 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.235 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*--------------------------------------------------------------------
|
*--------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.6 2004/08/29 05:06:51 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.7 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/bin/pgevent/pgevent.c,v 1.2 2004/08/29 05:06:54 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/pgevent/pgevent.c,v 1.3 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, 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/commands/dbcommands.h,v 1.34 2004/08/29 21:08:47 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.35 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, 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/commands/tablespace.h,v 1.4 2004/08/29 21:08:47 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.5 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, 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.249 2004/08/29 05:06:58 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.250 2004/08/30 02:54:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -718,7 +718,7 @@ extern Datum numeric_in(PG_FUNCTION_ARGS);
|
|||||||
extern Datum numeric_out(PG_FUNCTION_ARGS);
|
extern Datum numeric_out(PG_FUNCTION_ARGS);
|
||||||
extern Datum numeric_recv(PG_FUNCTION_ARGS);
|
extern Datum numeric_recv(PG_FUNCTION_ARGS);
|
||||||
extern Datum numeric_send(PG_FUNCTION_ARGS);
|
extern Datum numeric_send(PG_FUNCTION_ARGS);
|
||||||
extern Datum numeric(PG_FUNCTION_ARGS);
|
extern Datum numeric (PG_FUNCTION_ARGS);
|
||||||
extern Datum numeric_abs(PG_FUNCTION_ARGS);
|
extern Datum numeric_abs(PG_FUNCTION_ARGS);
|
||||||
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
|
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
|
||||||
extern Datum numeric_uplus(PG_FUNCTION_ARGS);
|
extern Datum numeric_uplus(PG_FUNCTION_ARGS);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
char *ECPGalloc(long, int);
|
char *ECPGalloc(long, int);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *))
|
deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *))
|
||||||
{
|
{
|
||||||
numeric *a1,
|
numeric *a1,
|
||||||
*a2;
|
*a2;
|
||||||
@ -53,7 +53,7 @@ deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *))
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric *, numeric *, numeric *))
|
deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, numeric *, numeric *))
|
||||||
{
|
{
|
||||||
numeric *a1,
|
numeric *a1,
|
||||||
*a2,
|
*a2,
|
||||||
@ -118,7 +118,7 @@ deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric *
|
|||||||
|
|
||||||
/* we start with the numeric functions */
|
/* we start with the numeric functions */
|
||||||
int
|
int
|
||||||
decadd(decimal * arg1, decimal * arg2, decimal * sum)
|
decadd(decimal *arg1, decimal *arg2, decimal *sum)
|
||||||
{
|
{
|
||||||
deccall3(arg1, arg2, sum, PGTYPESnumeric_add);
|
deccall3(arg1, arg2, sum, PGTYPESnumeric_add);
|
||||||
|
|
||||||
@ -131,13 +131,13 @@ decadd(decimal * arg1, decimal * arg2, decimal * sum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
deccmp(decimal * arg1, decimal * arg2)
|
deccmp(decimal *arg1, decimal *arg2)
|
||||||
{
|
{
|
||||||
return (deccall2(arg1, arg2, PGTYPESnumeric_cmp));
|
return (deccall2(arg1, arg2, PGTYPESnumeric_cmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
deccopy(decimal * src, decimal * target)
|
deccopy(decimal *src, decimal *target)
|
||||||
{
|
{
|
||||||
memcpy(target, src, sizeof(decimal));
|
memcpy(target, src, sizeof(decimal));
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ ecpg_strndup(const char *str, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
deccvasc(char *cp, int len, decimal * np)
|
deccvasc(char *cp, int len, decimal *np)
|
||||||
{
|
{
|
||||||
char *str = ecpg_strndup(cp, len); /* decimal_in always
|
char *str = ecpg_strndup(cp, len); /* decimal_in always
|
||||||
* converts the complete
|
* converts the complete
|
||||||
@ -208,7 +208,7 @@ deccvasc(char *cp, int len, decimal * np)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
deccvdbl(double dbl, decimal * np)
|
deccvdbl(double dbl, decimal *np)
|
||||||
{
|
{
|
||||||
numeric *nres = PGTYPESnumeric_new();
|
numeric *nres = PGTYPESnumeric_new();
|
||||||
int result = 1;
|
int result = 1;
|
||||||
@ -229,7 +229,7 @@ deccvdbl(double dbl, decimal * np)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
deccvint(int in, decimal * np)
|
deccvint(int in, decimal *np)
|
||||||
{
|
{
|
||||||
numeric *nres = PGTYPESnumeric_new();
|
numeric *nres = PGTYPESnumeric_new();
|
||||||
int result = 1;
|
int result = 1;
|
||||||
@ -250,7 +250,7 @@ deccvint(int in, decimal * np)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
deccvlong(long lng, decimal * np)
|
deccvlong(long lng, decimal *np)
|
||||||
{
|
{
|
||||||
numeric *nres = PGTYPESnumeric_new();
|
numeric *nres = PGTYPESnumeric_new();
|
||||||
int result = 1;
|
int result = 1;
|
||||||
@ -271,7 +271,7 @@ deccvlong(long lng, decimal * np)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
decdiv(decimal * n1, decimal * n2, decimal * result)
|
decdiv(decimal *n1, decimal *n2, decimal *result)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@ -296,7 +296,7 @@ decdiv(decimal * n1, decimal * n2, decimal * result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
decmul(decimal * n1, decimal * n2, decimal * result)
|
decmul(decimal *n1, decimal *n2, decimal *result)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ decmul(decimal * n1, decimal * n2, decimal * result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
decsub(decimal * n1, decimal * n2, decimal * result)
|
decsub(decimal *n1, decimal *n2, decimal *result)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ decsub(decimal * n1, decimal * n2, decimal * result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dectoasc(decimal * np, char *cp, int len, int right)
|
dectoasc(decimal *np, char *cp, int len, int right)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
numeric *nres = PGTYPESnumeric_new();
|
numeric *nres = PGTYPESnumeric_new();
|
||||||
@ -373,7 +373,7 @@ dectoasc(decimal * np, char *cp, int len, int right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dectodbl(decimal * np, double *dblp)
|
dectodbl(decimal *np, double *dblp)
|
||||||
{
|
{
|
||||||
numeric *nres = PGTYPESnumeric_new();
|
numeric *nres = PGTYPESnumeric_new();
|
||||||
int i;
|
int i;
|
||||||
@ -391,7 +391,7 @@ dectodbl(decimal * np, double *dblp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dectoint(decimal * np, int *ip)
|
dectoint(decimal *np, int *ip)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
numeric *nres = PGTYPESnumeric_new();
|
numeric *nres = PGTYPESnumeric_new();
|
||||||
@ -411,7 +411,7 @@ dectoint(decimal * np, int *ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dectolong(decimal * np, long *lngp)
|
dectolong(decimal *np, long *lngp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
numeric *nres = PGTYPESnumeric_new();;
|
numeric *nres = PGTYPESnumeric_new();;
|
||||||
@ -453,7 +453,7 @@ rdatestr(date d, char *str)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
rstrdate(char *str, date * d)
|
rstrdate(char *str, date *d)
|
||||||
{
|
{
|
||||||
date dat;
|
date dat;
|
||||||
char strbuf[10];
|
char strbuf[10];
|
||||||
@ -511,7 +511,7 @@ rstrdate(char *str, date * d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rtoday(date * d)
|
rtoday(date *d)
|
||||||
{
|
{
|
||||||
PGTYPESdate_today(d);
|
PGTYPESdate_today(d);
|
||||||
return;
|
return;
|
||||||
@ -530,7 +530,7 @@ rjulmdy(date d, short mdy[3])
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rdefmtdate(date * d, char *fmt, char *str)
|
rdefmtdate(date *d, char *fmt, char *str)
|
||||||
{
|
{
|
||||||
/* TODO: take care of DBCENTURY environment variable */
|
/* TODO: take care of DBCENTURY environment variable */
|
||||||
/* PGSQL functions allow all centuries */
|
/* PGSQL functions allow all centuries */
|
||||||
@ -567,7 +567,7 @@ rfmtdate(date d, char *fmt, char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rmdyjul(short mdy[3], date * d)
|
rmdyjul(short mdy[3], date *d)
|
||||||
{
|
{
|
||||||
int mdy_int[3];
|
int mdy_int[3];
|
||||||
|
|
||||||
@ -587,13 +587,13 @@ rdayofweek(date d)
|
|||||||
/* And the datetime stuff */
|
/* And the datetime stuff */
|
||||||
|
|
||||||
void
|
void
|
||||||
dtcurrent(timestamp * ts)
|
dtcurrent(timestamp *ts)
|
||||||
{
|
{
|
||||||
PGTYPEStimestamp_current(ts);
|
PGTYPEStimestamp_current(ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dtcvasc(char *str, timestamp * ts)
|
dtcvasc(char *str, timestamp *ts)
|
||||||
{
|
{
|
||||||
timestamp ts_tmp;
|
timestamp ts_tmp;
|
||||||
int i;
|
int i;
|
||||||
@ -616,13 +616,13 @@ dtcvasc(char *str, timestamp * ts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dtsub(timestamp * ts1, timestamp * ts2, interval * iv)
|
dtsub(timestamp *ts1, timestamp *ts2, interval *iv)
|
||||||
{
|
{
|
||||||
return PGTYPEStimestamp_sub(ts1, ts2, iv);
|
return PGTYPEStimestamp_sub(ts1, ts2, iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dttoasc(timestamp * ts, char *output)
|
dttoasc(timestamp *ts, char *output)
|
||||||
{
|
{
|
||||||
char *asctime = PGTYPEStimestamp_to_asc(*ts);
|
char *asctime = PGTYPEStimestamp_to_asc(*ts);
|
||||||
|
|
||||||
@ -632,13 +632,13 @@ dttoasc(timestamp * ts, char *output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr)
|
dttofmtasc(timestamp *ts, char *output, int str_len, char *fmtstr)
|
||||||
{
|
{
|
||||||
return PGTYPEStimestamp_fmt_asc(ts, output, str_len, fmtstr);
|
return PGTYPEStimestamp_fmt_asc(ts, output, str_len, fmtstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
intoasc(interval * i, char *str)
|
intoasc(interval *i, char *str)
|
||||||
{
|
{
|
||||||
str = PGTYPESinterval_to_asc(i);
|
str = PGTYPESinterval_to_asc(i);
|
||||||
|
|
||||||
@ -963,7 +963,7 @@ rtypwidth(int sqltype, int sqllen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue)
|
dtcvfmtasc(char *inbuf, char *fmtstr, timestamp *dtvalue)
|
||||||
{
|
{
|
||||||
return PGTYPEStimestamp_defmt_asc(inbuf, fmtstr, dtvalue);
|
return PGTYPEStimestamp_defmt_asc(inbuf, fmtstr, dtvalue);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
numeric * PGTYPESnumeric_new(void);
|
numeric *PGTYPESnumeric_new(void);
|
||||||
void PGTYPESnumeric_free(numeric *);
|
void PGTYPESnumeric_free(numeric *);
|
||||||
numeric *PGTYPESnumeric_from_asc(char *, char **);
|
numeric *PGTYPESnumeric_from_asc(char *, char **);
|
||||||
char *PGTYPESnumeric_to_asc(numeric *, int);
|
char *PGTYPESnumeric_to_asc(numeric *, int);
|
||||||
|
@ -111,7 +111,7 @@ PGTYPESdate_julmdy(date jd, int *mdy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PGTYPESdate_mdyjul(int *mdy, date * jdate)
|
PGTYPESdate_mdyjul(int *mdy, date *jdate)
|
||||||
{
|
{
|
||||||
/* month is mdy[0] */
|
/* month is mdy[0] */
|
||||||
/* day is mdy[1] */
|
/* day is mdy[1] */
|
||||||
@ -124,14 +124,14 @@ int
|
|||||||
PGTYPESdate_dayofweek(date dDate)
|
PGTYPESdate_dayofweek(date dDate)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Sunday: 0 Monday: 1 Tuesday: 2 Wednesday: 3 Thursday:
|
* Sunday: 0 Monday: 1 Tuesday: 2 Wednesday: 3 Thursday: 4
|
||||||
* 4 Friday: 5 Saturday: 6
|
* Friday: 5 Saturday: 6
|
||||||
*/
|
*/
|
||||||
return (int) (dDate + date2j(2000, 1, 1) + 1) % 7;
|
return (int) (dDate + date2j(2000, 1, 1) + 1) % 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PGTYPESdate_today(date * d)
|
PGTYPESdate_today(date *d)
|
||||||
{
|
{
|
||||||
struct tm ts;
|
struct tm ts;
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf)
|
|||||||
|
|
||||||
#define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */
|
#define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */
|
||||||
int
|
int
|
||||||
PGTYPESdate_defmt_asc(date * d, char *fmt, char *str)
|
PGTYPESdate_defmt_asc(date *d, char *fmt, char *str)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* token[2] = { 4,6 } means that token 2 starts at position 4 and ends
|
* token[2] = { 4,6 } means that token 2 starts at position 4 and ends
|
||||||
|
@ -2729,7 +2729,7 @@ int PGTYPEStimestamp_defmt_scan(char **, char *, timestamp *, int *, int *, int
|
|||||||
int *, int *, int *, int *);
|
int *, int *, int *, int *);
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
|
PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp *d,
|
||||||
int *year, int *month, int *day,
|
int *year, int *month, int *day,
|
||||||
int *hour, int *minute, int *second,
|
int *hour, int *minute, int *second,
|
||||||
int *tz)
|
int *tz)
|
||||||
|
@ -720,7 +720,7 @@ interval2tm(interval span, struct tm * tm, fsec_t *fsec)
|
|||||||
} /* interval2tm() */
|
} /* interval2tm() */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tm2interval(struct tm * tm, fsec_t fsec, interval * span)
|
tm2interval(struct tm * tm, fsec_t fsec, interval *span)
|
||||||
{
|
{
|
||||||
span->month = ((tm->tm_year * 12) + tm->tm_mon);
|
span->month = ((tm->tm_year * 12) + tm->tm_mon);
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
@ -797,7 +797,7 @@ PGTYPESinterval_from_asc(char *str, char **endptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
PGTYPESinterval_to_asc(interval * span)
|
PGTYPESinterval_to_asc(interval *span)
|
||||||
{
|
{
|
||||||
struct tm tt,
|
struct tm tt,
|
||||||
*tm = &tt;
|
*tm = &tt;
|
||||||
@ -821,7 +821,7 @@ PGTYPESinterval_to_asc(interval * span)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESinterval_copy(interval * intvlsrc, interval * intrcldest)
|
PGTYPESinterval_copy(interval *intvlsrc, interval *intrcldest)
|
||||||
{
|
{
|
||||||
intrcldest->time = intvlsrc->time;
|
intrcldest->time = intvlsrc->time;
|
||||||
intrcldest->month = intvlsrc->month;
|
intrcldest->month = intvlsrc->month;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
apply_typmod(numeric * var, long typmod)
|
apply_typmod(numeric *var, long typmod)
|
||||||
{
|
{
|
||||||
int precision;
|
int precision;
|
||||||
int scale;
|
int scale;
|
||||||
@ -108,7 +108,7 @@ apply_typmod(numeric * var, long typmod)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
alloc_var(numeric * var, int ndigits)
|
alloc_var(numeric *var, int ndigits)
|
||||||
{
|
{
|
||||||
digitbuf_free(var->buf);
|
digitbuf_free(var->buf);
|
||||||
var->buf = digitbuf_alloc(ndigits + 1);
|
var->buf = digitbuf_alloc(ndigits + 1);
|
||||||
@ -141,7 +141,7 @@ PGTYPESnumeric_new(void)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
set_var_from_str(char *str, char **ptr, numeric * dest)
|
set_var_from_str(char *str, char **ptr, numeric *dest)
|
||||||
{
|
{
|
||||||
bool have_dp = FALSE;
|
bool have_dp = FALSE;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -271,7 +271,7 @@ set_var_from_str(char *str, char **ptr, numeric * dest)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
get_str_from_var(numeric * var, int dscale)
|
get_str_from_var(numeric *var, int dscale)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -385,7 +385,7 @@ PGTYPESnumeric_from_asc(char *str, char **endptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
PGTYPESnumeric_to_asc(numeric * num, int dscale)
|
PGTYPESnumeric_to_asc(numeric *num, int dscale)
|
||||||
{
|
{
|
||||||
if (dscale < 0)
|
if (dscale < 0)
|
||||||
dscale = num->dscale;
|
dscale = num->dscale;
|
||||||
@ -401,7 +401,7 @@ PGTYPESnumeric_to_asc(numeric * num, int dscale)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
zero_var(numeric * var)
|
zero_var(numeric *var)
|
||||||
{
|
{
|
||||||
digitbuf_free(var->buf);
|
digitbuf_free(var->buf);
|
||||||
var->buf = NULL;
|
var->buf = NULL;
|
||||||
@ -412,7 +412,7 @@ zero_var(numeric * var)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PGTYPESnumeric_free(numeric * var)
|
PGTYPESnumeric_free(numeric *var)
|
||||||
{
|
{
|
||||||
digitbuf_free(var->buf);
|
digitbuf_free(var->buf);
|
||||||
free(var);
|
free(var);
|
||||||
@ -428,7 +428,7 @@ PGTYPESnumeric_free(numeric * var)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
cmp_abs(numeric * var1, numeric * var2)
|
cmp_abs(numeric *var1, numeric *var2)
|
||||||
{
|
{
|
||||||
int i1 = 0;
|
int i1 = 0;
|
||||||
int i2 = 0;
|
int i2 = 0;
|
||||||
@ -486,7 +486,7 @@ cmp_abs(numeric * var1, numeric * var2)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
add_abs(numeric * var1, numeric * var2, numeric * result)
|
add_abs(numeric *var1, numeric *var2, numeric *result)
|
||||||
{
|
{
|
||||||
NumericDigit *res_buf;
|
NumericDigit *res_buf;
|
||||||
NumericDigit *res_digits;
|
NumericDigit *res_digits;
|
||||||
@ -574,7 +574,7 @@ add_abs(numeric * var1, numeric * var2, numeric * result)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
sub_abs(numeric * var1, numeric * var2, numeric * result)
|
sub_abs(numeric *var1, numeric *var2, numeric *result)
|
||||||
{
|
{
|
||||||
NumericDigit *res_buf;
|
NumericDigit *res_buf;
|
||||||
NumericDigit *res_digits;
|
NumericDigit *res_digits;
|
||||||
@ -658,7 +658,7 @@ sub_abs(numeric * var1, numeric * var2, numeric * result)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result)
|
PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Decide on the signs of the two variables what to do
|
* Decide on the signs of the two variables what to do
|
||||||
@ -787,7 +787,7 @@ PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result)
|
PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Decide on the signs of the two variables what to do
|
* Decide on the signs of the two variables what to do
|
||||||
@ -918,7 +918,7 @@ PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result)
|
PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result)
|
||||||
{
|
{
|
||||||
NumericDigit *res_buf;
|
NumericDigit *res_buf;
|
||||||
NumericDigit *res_digits;
|
NumericDigit *res_digits;
|
||||||
@ -1009,7 +1009,7 @@ PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result)
|
|||||||
* Note that this must be called before div_var.
|
* Note that this must be called before div_var.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
select_div_scale(numeric * var1, numeric * var2, int *rscale)
|
select_div_scale(numeric *var1, numeric *var2, int *rscale)
|
||||||
{
|
{
|
||||||
int weight1,
|
int weight1,
|
||||||
weight2,
|
weight2,
|
||||||
@ -1076,7 +1076,7 @@ select_div_scale(numeric * var1, numeric * var2, int *rscale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result)
|
PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result)
|
||||||
{
|
{
|
||||||
NumericDigit *res_digits;
|
NumericDigit *res_digits;
|
||||||
int res_ndigits;
|
int res_ndigits;
|
||||||
@ -1282,7 +1282,7 @@ PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_cmp(numeric * var1, numeric * var2)
|
PGTYPESnumeric_cmp(numeric *var1, numeric *var2)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* use cmp_abs function to calculate the result */
|
/* use cmp_abs function to calculate the result */
|
||||||
@ -1313,7 +1313,7 @@ PGTYPESnumeric_cmp(numeric * var1, numeric * var2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_from_int(signed int int_val, numeric * var)
|
PGTYPESnumeric_from_int(signed int int_val, numeric *var)
|
||||||
{
|
{
|
||||||
/* implicit conversion */
|
/* implicit conversion */
|
||||||
signed long int long_int = int_val;
|
signed long int long_int = int_val;
|
||||||
@ -1322,7 +1322,7 @@ PGTYPESnumeric_from_int(signed int int_val, numeric * var)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_from_long(signed long int long_val, numeric * var)
|
PGTYPESnumeric_from_long(signed long int long_val, numeric *var)
|
||||||
{
|
{
|
||||||
/* calculate the size of the long int number */
|
/* calculate the size of the long int number */
|
||||||
/* a number n needs log_10 n digits */
|
/* a number n needs log_10 n digits */
|
||||||
@ -1392,7 +1392,7 @@ PGTYPESnumeric_from_long(signed long int long_val, numeric * var)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_copy(numeric * src, numeric * dst)
|
PGTYPESnumeric_copy(numeric *src, numeric *dst)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1415,7 +1415,7 @@ PGTYPESnumeric_copy(numeric * src, numeric * dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_from_double(double d, numeric * dst)
|
PGTYPESnumeric_from_double(double d, numeric *dst)
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
numeric *tmp;
|
numeric *tmp;
|
||||||
@ -1432,7 +1432,7 @@ PGTYPESnumeric_from_double(double d, numeric * dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
numericvar_to_double_no_overflow(numeric * var, double *dp)
|
numericvar_to_double_no_overflow(numeric *var, double *dp)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
double val;
|
double val;
|
||||||
@ -1456,7 +1456,7 @@ numericvar_to_double_no_overflow(numeric * var, double *dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_to_double(numeric * nv, double *dp)
|
PGTYPESnumeric_to_double(numeric *nv, double *dp)
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
int i;
|
int i;
|
||||||
@ -1468,7 +1468,7 @@ PGTYPESnumeric_to_double(numeric * nv, double *dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_to_int(numeric * nv, int *ip)
|
PGTYPESnumeric_to_int(numeric *nv, int *ip)
|
||||||
{
|
{
|
||||||
long l;
|
long l;
|
||||||
int i;
|
int i;
|
||||||
@ -1487,7 +1487,7 @@ PGTYPESnumeric_to_int(numeric * nv, int *ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_to_long(numeric * nv, long *lp)
|
PGTYPESnumeric_to_long(numeric *nv, long *lp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
long l = 0;
|
long l = 0;
|
||||||
@ -1515,7 +1515,7 @@ PGTYPESnumeric_to_long(numeric * nv, long *lp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_to_decimal(numeric * src, decimal * dst)
|
PGTYPESnumeric_to_decimal(numeric *src, decimal *dst)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1538,7 +1538,7 @@ PGTYPESnumeric_to_decimal(numeric * src, decimal * dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPESnumeric_from_decimal(decimal * src, numeric * dst)
|
PGTYPESnumeric_from_decimal(decimal *src, numeric *dst)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ dt2local(timestamp dt, int tz)
|
|||||||
* Returns -1 on failure (overflow).
|
* Returns -1 on failure (overflow).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp * result)
|
tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp *result)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
int dDate;
|
int dDate;
|
||||||
@ -372,7 +372,7 @@ PGTYPEStimestamp_to_asc(timestamp tstamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PGTYPEStimestamp_current(timestamp * ts)
|
PGTYPEStimestamp_current(timestamp *ts)
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ PGTYPEStimestamp_current(timestamp * ts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
|
dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm * tm,
|
||||||
char *output, int *pstr_len, char *fmtstr)
|
char *output, int *pstr_len, char *fmtstr)
|
||||||
{
|
{
|
||||||
union un_fmt_comb replace_val;
|
union un_fmt_comb replace_val;
|
||||||
@ -772,7 +772,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr)
|
PGTYPEStimestamp_fmt_asc(timestamp *ts, char *output, int str_len, char *fmtstr)
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
@ -787,7 +787,7 @@ PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
|
PGTYPEStimestamp_sub(timestamp *ts1, timestamp *ts2, interval *iv)
|
||||||
{
|
{
|
||||||
if (TIMESTAMP_NOT_FINITE(*ts1) || TIMESTAMP_NOT_FINITE(*ts2))
|
if (TIMESTAMP_NOT_FINITE(*ts1) || TIMESTAMP_NOT_FINITE(*ts2))
|
||||||
return PGTYPES_TS_ERR_EINFTIME;
|
return PGTYPES_TS_ERR_EINFTIME;
|
||||||
@ -804,7 +804,7 @@ PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp * d)
|
PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp *d)
|
||||||
{
|
{
|
||||||
int year,
|
int year,
|
||||||
month,
|
month,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.65 2004/08/29 04:13:11 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.66 2004/08/30 02:54:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -335,7 +335,7 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
{"write", WRITE},
|
{"write", WRITE},
|
||||||
{"year", YEAR_P},
|
{"year", YEAR_P},
|
||||||
{"zone", ZONE},
|
{"zone", ZONE},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ScanKeywordLookup - see if a given word is a keyword
|
* ScanKeywordLookup - see if a given word is a keyword
|
||||||
@ -349,9 +349,9 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
* keywords are to be matched in this way even though non-keyword identifiers
|
* keywords are to be matched in this way even though non-keyword identifiers
|
||||||
* receive a different case-normalization mapping.
|
* receive a different case-normalization mapping.
|
||||||
*/
|
*/
|
||||||
ScanKeyword *
|
ScanKeyword *
|
||||||
ScanKeywordLookup(char *text)
|
ScanKeywordLookup(char *text)
|
||||||
{
|
{
|
||||||
int len,
|
int len,
|
||||||
i;
|
i;
|
||||||
char word[NAMEDATALEN];
|
char word[NAMEDATALEN];
|
||||||
@ -364,8 +364,9 @@ ScanKeywordLookup(char *text)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Apply an ASCII-only downcasing. We must not use tolower() since it
|
* Apply an ASCII-only downcasing. We must not use tolower()
|
||||||
* may produce the wrong translation in some locales (eg, Turkish).
|
* since it may produce the wrong translation in some locales (eg,
|
||||||
|
* Turkish).
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
@ -398,4 +399,4 @@ ScanKeywordLookup(char *text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.161 2004/08/29 05:07:00 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.162 2004/08/30 02:54:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -458,7 +458,7 @@ pqPrepareAsyncResult(PGconn *conn)
|
|||||||
* a trailing newline, and should not be more than one line).
|
* a trailing newline, and should not be more than one line).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
|
pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
|
||||||
{
|
{
|
||||||
char msgBuf[1024];
|
char msgBuf[1024];
|
||||||
va_list args;
|
va_list args;
|
||||||
@ -503,7 +503,7 @@ pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
|
|||||||
* Returns TRUE if OK, FALSE if not enough memory to add the row
|
* Returns TRUE if OK, FALSE if not enough memory to add the row
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pqAddTuple(PGresult *res, PGresAttValue * tup)
|
pqAddTuple(PGresult *res, PGresAttValue *tup)
|
||||||
{
|
{
|
||||||
if (res->ntups >= res->tupArrSize)
|
if (res->ntups >= res->tupArrSize)
|
||||||
{
|
{
|
||||||
@ -592,7 +592,7 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value)
|
|||||||
* Store new info as a single malloc block
|
* Store new info as a single malloc block
|
||||||
*/
|
*/
|
||||||
pstatus = (pgParameterStatus *) malloc(sizeof(pgParameterStatus) +
|
pstatus = (pgParameterStatus *) malloc(sizeof(pgParameterStatus) +
|
||||||
strlen(name) + strlen(value) + 2);
|
strlen(name) +strlen(value) + 2);
|
||||||
if (pstatus)
|
if (pstatus)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.13 2004/08/29 05:07:00 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.14 2004/08/30 02:54:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1395,7 +1395,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid,
|
|||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
||||||
const PQEnvironmentOption * options)
|
const PQEnvironmentOption *options)
|
||||||
{
|
{
|
||||||
StartupPacket *startpacket;
|
StartupPacket *startpacket;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.15 2004/08/29 05:07:00 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.16 2004/08/30 02:54:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -52,7 +52,7 @@ static int getNotify(PGconn *conn);
|
|||||||
static int getCopyStart(PGconn *conn, ExecStatusType copytype);
|
static int getCopyStart(PGconn *conn, ExecStatusType copytype);
|
||||||
static int getReadyForQuery(PGconn *conn);
|
static int getReadyForQuery(PGconn *conn);
|
||||||
static int build_startup_packet(const PGconn *conn, char *packet,
|
static int build_startup_packet(const PGconn *conn, char *packet,
|
||||||
const PQEnvironmentOption * options);
|
const PQEnvironmentOption *options);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1400,7 +1400,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
|
|||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
||||||
const PQEnvironmentOption * options)
|
const PQEnvironmentOption *options)
|
||||||
{
|
{
|
||||||
char *startpacket;
|
char *startpacket;
|
||||||
|
|
||||||
@ -1423,7 +1423,7 @@ pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
build_startup_packet(const PGconn *conn, char *packet,
|
build_startup_packet(const PGconn *conn, char *packet,
|
||||||
const PQEnvironmentOption * options)
|
const PQEnvironmentOption *options)
|
||||||
{
|
{
|
||||||
int packet_len = 0;
|
int packet_len = 0;
|
||||||
const PQEnvironmentOption *next_eo;
|
const PQEnvironmentOption *next_eo;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, 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/interfaces/libpq/libpq-int.h,v 1.91 2004/08/29 05:07:00 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.92 2004/08/30 02:54:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -380,10 +380,10 @@ extern void pqClearAsyncResult(PGconn *conn);
|
|||||||
extern void pqSaveErrorResult(PGconn *conn);
|
extern void pqSaveErrorResult(PGconn *conn);
|
||||||
extern PGresult *pqPrepareAsyncResult(PGconn *conn);
|
extern PGresult *pqPrepareAsyncResult(PGconn *conn);
|
||||||
extern void
|
extern void
|
||||||
pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
|
pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
|
||||||
/* This lets gcc check the format string for consistency. */
|
/* This lets gcc check the format string for consistency. */
|
||||||
__attribute__((format(printf, 2, 3)));
|
__attribute__((format(printf, 2, 3)));
|
||||||
extern int pqAddTuple(PGresult *res, PGresAttValue * tup);
|
extern int pqAddTuple(PGresult *res, PGresAttValue *tup);
|
||||||
extern void pqSaveMessageField(PGresult *res, char code,
|
extern void pqSaveMessageField(PGresult *res, char code,
|
||||||
const char *value);
|
const char *value);
|
||||||
extern void pqSaveParameterStatus(PGconn *conn, const char *name,
|
extern void pqSaveParameterStatus(PGconn *conn, const char *name,
|
||||||
@ -395,7 +395,7 @@ extern void pqHandleSendFailure(PGconn *conn);
|
|||||||
extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn);
|
extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn);
|
||||||
|
|
||||||
extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
||||||
const PQEnvironmentOption * options);
|
const PQEnvironmentOption *options);
|
||||||
extern void pqParseInput2(PGconn *conn);
|
extern void pqParseInput2(PGconn *conn);
|
||||||
extern int pqGetCopyData2(PGconn *conn, char **buffer, int async);
|
extern int pqGetCopyData2(PGconn *conn, char **buffer, int async);
|
||||||
extern int pqGetline2(PGconn *conn, char *s, int maxlen);
|
extern int pqGetline2(PGconn *conn, char *s, int maxlen);
|
||||||
@ -409,7 +409,7 @@ extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid,
|
|||||||
/* === in fe-protocol3.c === */
|
/* === in fe-protocol3.c === */
|
||||||
|
|
||||||
extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
||||||
const PQEnvironmentOption * options);
|
const PQEnvironmentOption *options);
|
||||||
extern void pqParseInput3(PGconn *conn);
|
extern void pqParseInput3(PGconn *conn);
|
||||||
extern int pqGetErrorNotice3(PGconn *conn, bool isError);
|
extern int pqGetErrorNotice3(PGconn *conn, bool isError);
|
||||||
extern int pqGetCopyData3(PGconn *conn, char **buffer, int async);
|
extern int pqGetCopyData3(PGconn *conn, char **buffer, int async);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.49 2004/08/29 05:07:01 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.50 2004/08/30 02:54:41 momjian Exp $
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ plperl_safe_init(void)
|
|||||||
* turn a tuple into a hash expression and add it to a list
|
* turn a tuple into a hash expression and add it to a list
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void
|
static void
|
||||||
plperl_sv_add_tuple_value(SV * rv, HeapTuple tuple, TupleDesc tupdesc)
|
plperl_sv_add_tuple_value(SV *rv, HeapTuple tuple, TupleDesc tupdesc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *value;
|
char *value;
|
||||||
@ -384,7 +384,7 @@ plperl_trigger_build_args(FunctionCallInfo fcinfo)
|
|||||||
* check return value from plperl function
|
* check return value from plperl function
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
plperl_is_set(SV * sv)
|
plperl_is_set(SV *sv)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@ -432,7 +432,7 @@ plperl_is_set(SV * sv)
|
|||||||
* extract a list of keys from a hash
|
* extract a list of keys from a hash
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static AV *
|
static AV *
|
||||||
plperl_get_keys(HV * hv)
|
plperl_get_keys(HV *hv)
|
||||||
{
|
{
|
||||||
AV *ret;
|
AV *ret;
|
||||||
SV **svp;
|
SV **svp;
|
||||||
@ -458,7 +458,7 @@ plperl_get_keys(HV * hv)
|
|||||||
* extract a given key (by index) from a list of keys
|
* extract a given key (by index) from a list of keys
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static char *
|
static char *
|
||||||
plperl_get_key(AV * keys, int index)
|
plperl_get_key(AV *keys, int index)
|
||||||
{
|
{
|
||||||
SV **svp;
|
SV **svp;
|
||||||
int len;
|
int len;
|
||||||
@ -478,7 +478,7 @@ plperl_get_key(AV * keys, int index)
|
|||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static char *
|
static char *
|
||||||
plperl_get_elem(HV * hash, char *key)
|
plperl_get_elem(HV *hash, char *key)
|
||||||
{
|
{
|
||||||
SV **svp;
|
SV **svp;
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ plperl_get_elem(HV * hash, char *key)
|
|||||||
* set up the new tuple returned from a trigger
|
* set up the new tuple returned from a trigger
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static HeapTuple
|
static HeapTuple
|
||||||
plperl_modify_tuple(HV * hvTD, TriggerData *tdata, HeapTuple otup, Oid fn_oid)
|
plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup, Oid fn_oid)
|
||||||
{
|
{
|
||||||
SV **svp;
|
SV **svp;
|
||||||
HV *hvNew;
|
HV *hvNew;
|
||||||
@ -700,8 +700,8 @@ plperl_create_sub(char *s, bool trusted)
|
|||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
EXTERN_C void boot_DynaLoader(pTHX_ CV * cv);
|
EXTERN_C void boot_DynaLoader(pTHX_ CV *cv);
|
||||||
EXTERN_C void boot_SPI(pTHX_ CV * cv);
|
EXTERN_C void boot_SPI(pTHX_ CV *cv);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plperl_init_shared_libs(pTHX)
|
plperl_init_shared_libs(pTHX)
|
||||||
@ -717,7 +717,7 @@ plperl_init_shared_libs(pTHX)
|
|||||||
* stored in the prodesc structure. massages the input parms properly
|
* stored in the prodesc structure. massages the input parms properly
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static SV *
|
static SV *
|
||||||
plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
|
plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo)
|
||||||
{
|
{
|
||||||
dSP;
|
dSP;
|
||||||
SV *retval;
|
SV *retval;
|
||||||
@ -815,7 +815,7 @@ plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
|
|||||||
* through the RV stored in the prodesc structure. massages the input parms properly
|
* through the RV stored in the prodesc structure. massages the input parms properly
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static SV *
|
static SV *
|
||||||
plperl_call_perl_trigger_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo, SV * td)
|
plperl_call_perl_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo, SV *td)
|
||||||
{
|
{
|
||||||
dSP;
|
dSP;
|
||||||
SV *retval;
|
SV *retval;
|
||||||
|
@ -344,7 +344,7 @@ typedef NVTYPE NV;
|
|||||||
#else
|
#else
|
||||||
#if defined(USE_THREADS)
|
#if defined(USE_THREADS)
|
||||||
static SV *
|
static SV *
|
||||||
newRV_noinc(SV * sv)
|
newRV_noinc(SV *sv)
|
||||||
{
|
{
|
||||||
SV *nsv = (SV *) newRV(sv);
|
SV *nsv = (SV *) newRV(sv);
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ newRV_noinc(SV * sv)
|
|||||||
#if defined(NEED_newCONSTSUB)
|
#if defined(NEED_newCONSTSUB)
|
||||||
static
|
static
|
||||||
#else
|
#else
|
||||||
extern void newCONSTSUB(HV * stash, char *name, SV * sv);
|
extern void newCONSTSUB(HV *stash, char *name, SV *sv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
|
#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
|
||||||
@ -545,7 +545,7 @@ SV *sv;
|
|||||||
((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
|
((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
|
||||||
? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
|
? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
|
||||||
static char *
|
static char *
|
||||||
my_sv_2pvbyte(pTHX_ register SV * sv, STRLEN * lp)
|
my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
|
||||||
{
|
{
|
||||||
sv_utf8_downgrade(sv, 0);
|
sv_utf8_downgrade(sv, 0);
|
||||||
return SvPV(sv, *lp);
|
return SvPV(sv, *lp);
|
||||||
@ -560,7 +560,7 @@ my_sv_2pvbyte(pTHX_ register SV * sv, STRLEN * lp)
|
|||||||
((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
|
((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
|
||||||
? SvPVX(sv) : sv_2pv_nolen(sv))
|
? SvPVX(sv) : sv_2pv_nolen(sv))
|
||||||
static char *
|
static char *
|
||||||
sv_2pv_nolen(pTHX_ register SV * sv)
|
sv_2pv_nolen(pTHX_ register SV *sv)
|
||||||
{
|
{
|
||||||
STRLEN n_a;
|
STRLEN n_a;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.80 2004/08/29 05:07:01 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.81 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -116,7 +116,7 @@ static const ExceptionLabelMap exception_label_map[] = {
|
|||||||
*/
|
*/
|
||||||
static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
|
static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
|
||||||
HeapTuple procTup,
|
HeapTuple procTup,
|
||||||
PLpgSQL_func_hashkey * hashkey,
|
PLpgSQL_func_hashkey *hashkey,
|
||||||
bool forValidator);
|
bool forValidator);
|
||||||
static void plpgsql_compile_error_callback(void *arg);
|
static void plpgsql_compile_error_callback(void *arg);
|
||||||
static char **fetchArgNames(HeapTuple procTup, int nargs);
|
static char **fetchArgNames(HeapTuple procTup, int nargs);
|
||||||
@ -124,12 +124,12 @@ static PLpgSQL_row *build_row_var(Oid classOid);
|
|||||||
static PLpgSQL_type *build_datatype(HeapTuple typeTup, int32 typmod);
|
static PLpgSQL_type *build_datatype(HeapTuple typeTup, int32 typmod);
|
||||||
static void compute_function_hashkey(FunctionCallInfo fcinfo,
|
static void compute_function_hashkey(FunctionCallInfo fcinfo,
|
||||||
Form_pg_proc procStruct,
|
Form_pg_proc procStruct,
|
||||||
PLpgSQL_func_hashkey * hashkey,
|
PLpgSQL_func_hashkey *hashkey,
|
||||||
bool forValidator);
|
bool forValidator);
|
||||||
static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key);
|
static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key);
|
||||||
static void plpgsql_HashTableInsert(PLpgSQL_function * function,
|
static void plpgsql_HashTableInsert(PLpgSQL_function *function,
|
||||||
PLpgSQL_func_hashkey * func_key);
|
PLpgSQL_func_hashkey *func_key);
|
||||||
static void plpgsql_HashTableDelete(PLpgSQL_function * function);
|
static void plpgsql_HashTableDelete(PLpgSQL_function *function);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This routine is a crock, and so is everyplace that calls it. The problem
|
* This routine is a crock, and so is everyplace that calls it. The problem
|
||||||
@ -254,7 +254,7 @@ plpgsql_compile(FunctionCallInfo fcinfo, bool forValidator)
|
|||||||
static PLpgSQL_function *
|
static PLpgSQL_function *
|
||||||
do_compile(FunctionCallInfo fcinfo,
|
do_compile(FunctionCallInfo fcinfo,
|
||||||
HeapTuple procTup,
|
HeapTuple procTup,
|
||||||
PLpgSQL_func_hashkey * hashkey,
|
PLpgSQL_func_hashkey *hashkey,
|
||||||
bool forValidator)
|
bool forValidator)
|
||||||
{
|
{
|
||||||
Form_pg_proc procStruct = (Form_pg_proc) GETSTRUCT(procTup);
|
Form_pg_proc procStruct = (Form_pg_proc) GETSTRUCT(procTup);
|
||||||
@ -1437,7 +1437,7 @@ plpgsql_parse_dblwordrowtype(char *word)
|
|||||||
* to the current datum array, and optionally to the current namespace.
|
* to the current datum array, and optionally to the current namespace.
|
||||||
*/
|
*/
|
||||||
PLpgSQL_variable *
|
PLpgSQL_variable *
|
||||||
plpgsql_build_variable(char *refname, int lineno, PLpgSQL_type * dtype,
|
plpgsql_build_variable(char *refname, int lineno, PLpgSQL_type *dtype,
|
||||||
bool add2namespace)
|
bool add2namespace)
|
||||||
{
|
{
|
||||||
PLpgSQL_variable *result;
|
PLpgSQL_variable *result;
|
||||||
@ -1789,7 +1789,7 @@ plpgsql_parse_err_condition(char *condname)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
plpgsql_adddatum(PLpgSQL_datum * new)
|
plpgsql_adddatum(PLpgSQL_datum *new)
|
||||||
{
|
{
|
||||||
if (plpgsql_nDatums == datums_alloc)
|
if (plpgsql_nDatums == datums_alloc)
|
||||||
{
|
{
|
||||||
@ -1865,7 +1865,7 @@ plpgsql_add_initdatums(int **varnos)
|
|||||||
static void
|
static void
|
||||||
compute_function_hashkey(FunctionCallInfo fcinfo,
|
compute_function_hashkey(FunctionCallInfo fcinfo,
|
||||||
Form_pg_proc procStruct,
|
Form_pg_proc procStruct,
|
||||||
PLpgSQL_func_hashkey * hashkey,
|
PLpgSQL_func_hashkey *hashkey,
|
||||||
bool forValidator)
|
bool forValidator)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1944,7 +1944,7 @@ plpgsql_HashTableInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PLpgSQL_function *
|
static PLpgSQL_function *
|
||||||
plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key)
|
plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key)
|
||||||
{
|
{
|
||||||
plpgsql_HashEnt *hentry;
|
plpgsql_HashEnt *hentry;
|
||||||
|
|
||||||
@ -1959,8 +1959,8 @@ plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plpgsql_HashTableInsert(PLpgSQL_function * function,
|
plpgsql_HashTableInsert(PLpgSQL_function *function,
|
||||||
PLpgSQL_func_hashkey * func_key)
|
PLpgSQL_func_hashkey *func_key)
|
||||||
{
|
{
|
||||||
plpgsql_HashEnt *hentry;
|
plpgsql_HashEnt *hentry;
|
||||||
bool found;
|
bool found;
|
||||||
@ -1982,7 +1982,7 @@ plpgsql_HashTableInsert(PLpgSQL_function * function,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plpgsql_HashTableDelete(PLpgSQL_function * function)
|
plpgsql_HashTableDelete(PLpgSQL_function *function)
|
||||||
{
|
{
|
||||||
plpgsql_HashEnt *hentry;
|
plpgsql_HashEnt *hentry;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.117 2004/08/29 05:07:01 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.118 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -74,98 +74,98 @@ static PLpgSQL_expr *active_simple_exprs = NULL;
|
|||||||
* Local function forward declarations
|
* Local function forward declarations
|
||||||
************************************************************/
|
************************************************************/
|
||||||
static void plpgsql_exec_error_callback(void *arg);
|
static void plpgsql_exec_error_callback(void *arg);
|
||||||
static PLpgSQL_var *copy_var(PLpgSQL_var * var);
|
static PLpgSQL_var *copy_var(PLpgSQL_var *var);
|
||||||
static PLpgSQL_rec *copy_rec(PLpgSQL_rec * rec);
|
static PLpgSQL_rec *copy_rec(PLpgSQL_rec *rec);
|
||||||
|
|
||||||
static int exec_stmt_block(PLpgSQL_execstate * estate,
|
static int exec_stmt_block(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_block * block);
|
PLpgSQL_stmt_block *block);
|
||||||
static int exec_stmts(PLpgSQL_execstate * estate,
|
static int exec_stmts(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmts * stmts);
|
PLpgSQL_stmts *stmts);
|
||||||
static int exec_stmt(PLpgSQL_execstate * estate,
|
static int exec_stmt(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt * stmt);
|
PLpgSQL_stmt *stmt);
|
||||||
static int exec_stmt_assign(PLpgSQL_execstate * estate,
|
static int exec_stmt_assign(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_assign * stmt);
|
PLpgSQL_stmt_assign *stmt);
|
||||||
static int exec_stmt_perform(PLpgSQL_execstate * estate,
|
static int exec_stmt_perform(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_perform * stmt);
|
PLpgSQL_stmt_perform *stmt);
|
||||||
static int exec_stmt_getdiag(PLpgSQL_execstate * estate,
|
static int exec_stmt_getdiag(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_getdiag * stmt);
|
PLpgSQL_stmt_getdiag *stmt);
|
||||||
static int exec_stmt_if(PLpgSQL_execstate * estate,
|
static int exec_stmt_if(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_if * stmt);
|
PLpgSQL_stmt_if *stmt);
|
||||||
static int exec_stmt_loop(PLpgSQL_execstate * estate,
|
static int exec_stmt_loop(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_loop * stmt);
|
PLpgSQL_stmt_loop *stmt);
|
||||||
static int exec_stmt_while(PLpgSQL_execstate * estate,
|
static int exec_stmt_while(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_while * stmt);
|
PLpgSQL_stmt_while *stmt);
|
||||||
static int exec_stmt_fori(PLpgSQL_execstate * estate,
|
static int exec_stmt_fori(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_fori * stmt);
|
PLpgSQL_stmt_fori *stmt);
|
||||||
static int exec_stmt_fors(PLpgSQL_execstate * estate,
|
static int exec_stmt_fors(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_fors * stmt);
|
PLpgSQL_stmt_fors *stmt);
|
||||||
static int exec_stmt_select(PLpgSQL_execstate * estate,
|
static int exec_stmt_select(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_select * stmt);
|
PLpgSQL_stmt_select *stmt);
|
||||||
static int exec_stmt_open(PLpgSQL_execstate * estate,
|
static int exec_stmt_open(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_open * stmt);
|
PLpgSQL_stmt_open *stmt);
|
||||||
static int exec_stmt_fetch(PLpgSQL_execstate * estate,
|
static int exec_stmt_fetch(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_fetch * stmt);
|
PLpgSQL_stmt_fetch *stmt);
|
||||||
static int exec_stmt_close(PLpgSQL_execstate * estate,
|
static int exec_stmt_close(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_close * stmt);
|
PLpgSQL_stmt_close *stmt);
|
||||||
static int exec_stmt_exit(PLpgSQL_execstate * estate,
|
static int exec_stmt_exit(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_exit * stmt);
|
PLpgSQL_stmt_exit *stmt);
|
||||||
static int exec_stmt_return(PLpgSQL_execstate * estate,
|
static int exec_stmt_return(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_return * stmt);
|
PLpgSQL_stmt_return *stmt);
|
||||||
static int exec_stmt_return_next(PLpgSQL_execstate * estate,
|
static int exec_stmt_return_next(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_return_next * stmt);
|
PLpgSQL_stmt_return_next *stmt);
|
||||||
static int exec_stmt_raise(PLpgSQL_execstate * estate,
|
static int exec_stmt_raise(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_raise * stmt);
|
PLpgSQL_stmt_raise *stmt);
|
||||||
static int exec_stmt_execsql(PLpgSQL_execstate * estate,
|
static int exec_stmt_execsql(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_execsql * stmt);
|
PLpgSQL_stmt_execsql *stmt);
|
||||||
static int exec_stmt_dynexecute(PLpgSQL_execstate * estate,
|
static int exec_stmt_dynexecute(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_dynexecute * stmt);
|
PLpgSQL_stmt_dynexecute *stmt);
|
||||||
static int exec_stmt_dynfors(PLpgSQL_execstate * estate,
|
static int exec_stmt_dynfors(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_dynfors * stmt);
|
PLpgSQL_stmt_dynfors *stmt);
|
||||||
|
|
||||||
static void plpgsql_estate_setup(PLpgSQL_execstate * estate,
|
static void plpgsql_estate_setup(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_function * func,
|
PLpgSQL_function *func,
|
||||||
ReturnSetInfo *rsi);
|
ReturnSetInfo *rsi);
|
||||||
static void exec_eval_cleanup(PLpgSQL_execstate * estate);
|
static void exec_eval_cleanup(PLpgSQL_execstate *estate);
|
||||||
|
|
||||||
static void exec_prepare_plan(PLpgSQL_execstate * estate,
|
static void exec_prepare_plan(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr);
|
PLpgSQL_expr *expr);
|
||||||
static bool exec_simple_check_node(Node *node);
|
static bool exec_simple_check_node(Node *node);
|
||||||
static void exec_simple_check_plan(PLpgSQL_expr * expr);
|
static void exec_simple_check_plan(PLpgSQL_expr *expr);
|
||||||
static Datum exec_eval_simple_expr(PLpgSQL_execstate * estate,
|
static Datum exec_eval_simple_expr(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull,
|
bool *isNull,
|
||||||
Oid *rettype);
|
Oid *rettype);
|
||||||
|
|
||||||
static void exec_assign_expr(PLpgSQL_execstate * estate,
|
static void exec_assign_expr(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_datum * target,
|
PLpgSQL_datum *target,
|
||||||
PLpgSQL_expr * expr);
|
PLpgSQL_expr *expr);
|
||||||
static void exec_assign_value(PLpgSQL_execstate * estate,
|
static void exec_assign_value(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_datum * target,
|
PLpgSQL_datum *target,
|
||||||
Datum value, Oid valtype, bool *isNull);
|
Datum value, Oid valtype, bool *isNull);
|
||||||
static void exec_eval_datum(PLpgSQL_execstate * estate,
|
static void exec_eval_datum(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_datum * datum,
|
PLpgSQL_datum *datum,
|
||||||
Oid expectedtypeid,
|
Oid expectedtypeid,
|
||||||
Oid *typeid,
|
Oid *typeid,
|
||||||
Datum *value,
|
Datum *value,
|
||||||
bool *isnull);
|
bool *isnull);
|
||||||
static int exec_eval_integer(PLpgSQL_execstate * estate,
|
static int exec_eval_integer(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull);
|
bool *isNull);
|
||||||
static bool exec_eval_boolean(PLpgSQL_execstate * estate,
|
static bool exec_eval_boolean(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull);
|
bool *isNull);
|
||||||
static Datum exec_eval_expr(PLpgSQL_execstate * estate,
|
static Datum exec_eval_expr(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull,
|
bool *isNull,
|
||||||
Oid *rettype);
|
Oid *rettype);
|
||||||
static int exec_run_select(PLpgSQL_execstate * estate,
|
static int exec_run_select(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr, int maxtuples, Portal *portalP);
|
PLpgSQL_expr *expr, int maxtuples, Portal *portalP);
|
||||||
static void exec_move_row(PLpgSQL_execstate * estate,
|
static void exec_move_row(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_rec * rec,
|
PLpgSQL_rec *rec,
|
||||||
PLpgSQL_row * row,
|
PLpgSQL_row *row,
|
||||||
HeapTuple tup, TupleDesc tupdesc);
|
HeapTuple tup, TupleDesc tupdesc);
|
||||||
static HeapTuple make_tuple_from_row(PLpgSQL_execstate * estate,
|
static HeapTuple make_tuple_from_row(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_row * row,
|
PLpgSQL_row *row,
|
||||||
TupleDesc tupdesc);
|
TupleDesc tupdesc);
|
||||||
static char *convert_value_to_string(Datum value, Oid valtype);
|
static char *convert_value_to_string(Datum value, Oid valtype);
|
||||||
static Datum exec_cast_value(Datum value, Oid valtype,
|
static Datum exec_cast_value(Datum value, Oid valtype,
|
||||||
@ -177,9 +177,9 @@ static Datum exec_cast_value(Datum value, Oid valtype,
|
|||||||
static Datum exec_simple_cast_value(Datum value, Oid valtype,
|
static Datum exec_simple_cast_value(Datum value, Oid valtype,
|
||||||
Oid reqtype, int32 reqtypmod,
|
Oid reqtype, int32 reqtypmod,
|
||||||
bool *isnull);
|
bool *isnull);
|
||||||
static void exec_init_tuple_store(PLpgSQL_execstate * estate);
|
static void exec_init_tuple_store(PLpgSQL_execstate *estate);
|
||||||
static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2);
|
static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2);
|
||||||
static void exec_set_found(PLpgSQL_execstate * estate, bool state);
|
static void exec_set_found(PLpgSQL_execstate *estate, bool state);
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
@ -188,7 +188,7 @@ static void exec_set_found(PLpgSQL_execstate * estate, bool state);
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
Datum
|
Datum
|
||||||
plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
|
plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo)
|
||||||
{
|
{
|
||||||
PLpgSQL_execstate estate;
|
PLpgSQL_execstate estate;
|
||||||
ErrorContextCallback plerrcontext;
|
ErrorContextCallback plerrcontext;
|
||||||
@ -438,7 +438,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
HeapTuple
|
HeapTuple
|
||||||
plpgsql_exec_trigger(PLpgSQL_function * func,
|
plpgsql_exec_trigger(PLpgSQL_function *func,
|
||||||
TriggerData *trigdata)
|
TriggerData *trigdata)
|
||||||
{
|
{
|
||||||
PLpgSQL_execstate estate;
|
PLpgSQL_execstate estate;
|
||||||
@ -759,7 +759,7 @@ plpgsql_exec_error_callback(void *arg)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static PLpgSQL_var *
|
static PLpgSQL_var *
|
||||||
copy_var(PLpgSQL_var * var)
|
copy_var(PLpgSQL_var *var)
|
||||||
{
|
{
|
||||||
PLpgSQL_var *new = palloc(sizeof(PLpgSQL_var));
|
PLpgSQL_var *new = palloc(sizeof(PLpgSQL_var));
|
||||||
|
|
||||||
@ -771,7 +771,7 @@ copy_var(PLpgSQL_var * var)
|
|||||||
|
|
||||||
|
|
||||||
static PLpgSQL_rec *
|
static PLpgSQL_rec *
|
||||||
copy_rec(PLpgSQL_rec * rec)
|
copy_rec(PLpgSQL_rec *rec)
|
||||||
{
|
{
|
||||||
PLpgSQL_rec *new = palloc(sizeof(PLpgSQL_rec));
|
PLpgSQL_rec *new = palloc(sizeof(PLpgSQL_rec));
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ copy_rec(PLpgSQL_rec * rec)
|
|||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
exception_matches_conditions(ErrorData *edata, PLpgSQL_condition * cond)
|
exception_matches_conditions(ErrorData *edata, PLpgSQL_condition *cond)
|
||||||
{
|
{
|
||||||
for (; cond != NULL; cond = cond->next)
|
for (; cond != NULL; cond = cond->next)
|
||||||
{
|
{
|
||||||
@ -818,7 +818,7 @@ exception_matches_conditions(ErrorData *edata, PLpgSQL_condition * cond)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_block(PLpgSQL_execstate * estate, PLpgSQL_stmt_block * block)
|
exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
|
||||||
{
|
{
|
||||||
volatile int rc = -1;
|
volatile int rc = -1;
|
||||||
int i;
|
int i;
|
||||||
@ -1006,7 +1006,7 @@ exec_stmt_block(PLpgSQL_execstate * estate, PLpgSQL_stmt_block * block)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmts(PLpgSQL_execstate * estate, PLpgSQL_stmts * stmts)
|
exec_stmts(PLpgSQL_execstate *estate, PLpgSQL_stmts *stmts)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
int i;
|
int i;
|
||||||
@ -1028,7 +1028,7 @@ exec_stmts(PLpgSQL_execstate * estate, PLpgSQL_stmts * stmts)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt(PLpgSQL_execstate * estate, PLpgSQL_stmt * stmt)
|
exec_stmt(PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_stmt *save_estmt;
|
PLpgSQL_stmt *save_estmt;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
@ -1137,7 +1137,7 @@ exec_stmt(PLpgSQL_execstate * estate, PLpgSQL_stmt * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt)
|
exec_stmt_assign(PLpgSQL_execstate *estate, PLpgSQL_stmt_assign *stmt)
|
||||||
{
|
{
|
||||||
Assert(stmt->varno >= 0);
|
Assert(stmt->varno >= 0);
|
||||||
|
|
||||||
@ -1153,7 +1153,7 @@ exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_perform(PLpgSQL_execstate * estate, PLpgSQL_stmt_perform * stmt)
|
exec_stmt_perform(PLpgSQL_execstate *estate, PLpgSQL_stmt_perform *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_expr *expr = stmt->expr;
|
PLpgSQL_expr *expr = stmt->expr;
|
||||||
int rc;
|
int rc;
|
||||||
@ -1183,7 +1183,7 @@ exec_stmt_perform(PLpgSQL_execstate * estate, PLpgSQL_stmt_perform * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_getdiag(PLpgSQL_execstate * estate, PLpgSQL_stmt_getdiag * stmt)
|
exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PLpgSQL_datum *var;
|
PLpgSQL_datum *var;
|
||||||
@ -1233,7 +1233,7 @@ exec_stmt_getdiag(PLpgSQL_execstate * estate, PLpgSQL_stmt_getdiag * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_if(PLpgSQL_execstate * estate, PLpgSQL_stmt_if * stmt)
|
exec_stmt_if(PLpgSQL_execstate *estate, PLpgSQL_stmt_if *stmt)
|
||||||
{
|
{
|
||||||
bool value;
|
bool value;
|
||||||
bool isnull = false;
|
bool isnull = false;
|
||||||
@ -1262,7 +1262,7 @@ exec_stmt_if(PLpgSQL_execstate * estate, PLpgSQL_stmt_if * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_loop(PLpgSQL_execstate * estate, PLpgSQL_stmt_loop * stmt)
|
exec_stmt_loop(PLpgSQL_execstate *estate, PLpgSQL_stmt_loop *stmt)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -1304,7 +1304,7 @@ exec_stmt_loop(PLpgSQL_execstate * estate, PLpgSQL_stmt_loop * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_while(PLpgSQL_execstate * estate, PLpgSQL_stmt_while * stmt)
|
exec_stmt_while(PLpgSQL_execstate *estate, PLpgSQL_stmt_while *stmt)
|
||||||
{
|
{
|
||||||
bool value;
|
bool value;
|
||||||
bool isnull = false;
|
bool isnull = false;
|
||||||
@ -1354,7 +1354,7 @@ exec_stmt_while(PLpgSQL_execstate * estate, PLpgSQL_stmt_while * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
|
exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_var *var;
|
PLpgSQL_var *var;
|
||||||
Datum value;
|
Datum value;
|
||||||
@ -1474,7 +1474,7 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
|
exec_stmt_fors(PLpgSQL_execstate *estate, PLpgSQL_stmt_fors *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_rec *rec = NULL;
|
PLpgSQL_rec *rec = NULL;
|
||||||
PLpgSQL_row *row = NULL;
|
PLpgSQL_row *row = NULL;
|
||||||
@ -1604,7 +1604,7 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_select(PLpgSQL_execstate * estate, PLpgSQL_stmt_select * stmt)
|
exec_stmt_select(PLpgSQL_execstate *estate, PLpgSQL_stmt_select *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_rec *rec = NULL;
|
PLpgSQL_rec *rec = NULL;
|
||||||
PLpgSQL_row *row = NULL;
|
PLpgSQL_row *row = NULL;
|
||||||
@ -1661,7 +1661,7 @@ exec_stmt_select(PLpgSQL_execstate * estate, PLpgSQL_stmt_select * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_exit(PLpgSQL_execstate * estate, PLpgSQL_stmt_exit * stmt)
|
exec_stmt_exit(PLpgSQL_execstate *estate, PLpgSQL_stmt_exit *stmt)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If the exit has a condition, check that it's true
|
* If the exit has a condition, check that it's true
|
||||||
@ -1688,7 +1688,7 @@ exec_stmt_exit(PLpgSQL_execstate * estate, PLpgSQL_stmt_exit * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt)
|
exec_stmt_return(PLpgSQL_execstate *estate, PLpgSQL_stmt_return *stmt)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If processing a set-returning PL/PgSQL function, the final RETURN
|
* If processing a set-returning PL/PgSQL function, the final RETURN
|
||||||
@ -1772,8 +1772,8 @@ exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_return_next(PLpgSQL_execstate * estate,
|
exec_stmt_return_next(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_return_next * stmt)
|
PLpgSQL_stmt_return_next *stmt)
|
||||||
{
|
{
|
||||||
TupleDesc tupdesc;
|
TupleDesc tupdesc;
|
||||||
int natts;
|
int natts;
|
||||||
@ -1873,7 +1873,7 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exec_init_tuple_store(PLpgSQL_execstate * estate)
|
exec_init_tuple_store(PLpgSQL_execstate *estate)
|
||||||
{
|
{
|
||||||
ReturnSetInfo *rsi = estate->rsi;
|
ReturnSetInfo *rsi = estate->rsi;
|
||||||
MemoryContext oldcxt;
|
MemoryContext oldcxt;
|
||||||
@ -1902,7 +1902,7 @@ exec_init_tuple_store(PLpgSQL_execstate * estate)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
|
exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
|
||||||
{
|
{
|
||||||
Oid paramtypeid;
|
Oid paramtypeid;
|
||||||
Datum paramvalue;
|
Datum paramvalue;
|
||||||
@ -1972,8 +1972,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
plpgsql_estate_setup(PLpgSQL_execstate * estate,
|
plpgsql_estate_setup(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_function * func,
|
PLpgSQL_function *func,
|
||||||
ReturnSetInfo *rsi)
|
ReturnSetInfo *rsi)
|
||||||
{
|
{
|
||||||
estate->retval = (Datum) 0;
|
estate->retval = (Datum) 0;
|
||||||
@ -2017,7 +2017,7 @@ plpgsql_estate_setup(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_eval_cleanup(PLpgSQL_execstate * estate)
|
exec_eval_cleanup(PLpgSQL_execstate *estate)
|
||||||
{
|
{
|
||||||
/* Clear result of a full SPI_exec */
|
/* Clear result of a full SPI_exec */
|
||||||
if (estate->eval_tuptable != NULL)
|
if (estate->eval_tuptable != NULL)
|
||||||
@ -2035,8 +2035,8 @@ exec_eval_cleanup(PLpgSQL_execstate * estate)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_prepare_plan(PLpgSQL_execstate * estate,
|
exec_prepare_plan(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr)
|
PLpgSQL_expr *expr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
_SPI_plan *spi_plan;
|
_SPI_plan *spi_plan;
|
||||||
@ -2104,8 +2104,8 @@ exec_prepare_plan(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_execsql(PLpgSQL_execstate * estate,
|
exec_stmt_execsql(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_execsql * stmt)
|
PLpgSQL_stmt_execsql *stmt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Datum *values;
|
Datum *values;
|
||||||
@ -2195,8 +2195,8 @@ exec_stmt_execsql(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_dynexecute(PLpgSQL_execstate * estate,
|
exec_stmt_dynexecute(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_stmt_dynexecute * stmt)
|
PLpgSQL_stmt_dynexecute *stmt)
|
||||||
{
|
{
|
||||||
Datum query;
|
Datum query;
|
||||||
bool isnull = false;
|
bool isnull = false;
|
||||||
@ -2309,7 +2309,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
|
exec_stmt_dynfors(PLpgSQL_execstate *estate, PLpgSQL_stmt_dynfors *stmt)
|
||||||
{
|
{
|
||||||
Datum query;
|
Datum query;
|
||||||
bool isnull = false;
|
bool isnull = false;
|
||||||
@ -2469,7 +2469,7 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
|
exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_var *curvar = NULL;
|
PLpgSQL_var *curvar = NULL;
|
||||||
char *curname = NULL;
|
char *curname = NULL;
|
||||||
@ -2673,7 +2673,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_fetch(PLpgSQL_execstate * estate, PLpgSQL_stmt_fetch * stmt)
|
exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_var *curvar = NULL;
|
PLpgSQL_var *curvar = NULL;
|
||||||
PLpgSQL_rec *rec = NULL;
|
PLpgSQL_rec *rec = NULL;
|
||||||
@ -2746,7 +2746,7 @@ exec_stmt_fetch(PLpgSQL_execstate * estate, PLpgSQL_stmt_fetch * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_stmt_close(PLpgSQL_execstate * estate, PLpgSQL_stmt_close * stmt)
|
exec_stmt_close(PLpgSQL_execstate *estate, PLpgSQL_stmt_close *stmt)
|
||||||
{
|
{
|
||||||
PLpgSQL_var *curvar = NULL;
|
PLpgSQL_var *curvar = NULL;
|
||||||
Portal portal;
|
Portal portal;
|
||||||
@ -2786,8 +2786,8 @@ exec_stmt_close(PLpgSQL_execstate * estate, PLpgSQL_stmt_close * stmt)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_assign_expr(PLpgSQL_execstate * estate, PLpgSQL_datum * target,
|
exec_assign_expr(PLpgSQL_execstate *estate, PLpgSQL_datum *target,
|
||||||
PLpgSQL_expr * expr)
|
PLpgSQL_expr *expr)
|
||||||
{
|
{
|
||||||
Datum value;
|
Datum value;
|
||||||
Oid valtype;
|
Oid valtype;
|
||||||
@ -2804,8 +2804,8 @@ exec_assign_expr(PLpgSQL_execstate * estate, PLpgSQL_datum * target,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_assign_value(PLpgSQL_execstate * estate,
|
exec_assign_value(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_datum * target,
|
PLpgSQL_datum *target,
|
||||||
Datum value, Oid valtype, bool *isNull)
|
Datum value, Oid valtype, bool *isNull)
|
||||||
{
|
{
|
||||||
switch (target->dtype)
|
switch (target->dtype)
|
||||||
@ -3195,8 +3195,8 @@ exec_assign_value(PLpgSQL_execstate * estate,
|
|||||||
* at the stored value in the case of pass-by-reference datatypes.
|
* at the stored value in the case of pass-by-reference datatypes.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_eval_datum(PLpgSQL_execstate * estate,
|
exec_eval_datum(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_datum * datum,
|
PLpgSQL_datum *datum,
|
||||||
Oid expectedtypeid,
|
Oid expectedtypeid,
|
||||||
Oid *typeid,
|
Oid *typeid,
|
||||||
Datum *value,
|
Datum *value,
|
||||||
@ -3348,8 +3348,8 @@ exec_eval_datum(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_eval_integer(PLpgSQL_execstate * estate,
|
exec_eval_integer(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull)
|
bool *isNull)
|
||||||
{
|
{
|
||||||
Datum exprdatum;
|
Datum exprdatum;
|
||||||
@ -3370,8 +3370,8 @@ exec_eval_integer(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
exec_eval_boolean(PLpgSQL_execstate * estate,
|
exec_eval_boolean(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull)
|
bool *isNull)
|
||||||
{
|
{
|
||||||
Datum exprdatum;
|
Datum exprdatum;
|
||||||
@ -3392,8 +3392,8 @@ exec_eval_boolean(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static Datum
|
static Datum
|
||||||
exec_eval_expr(PLpgSQL_execstate * estate,
|
exec_eval_expr(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull,
|
bool *isNull,
|
||||||
Oid *rettype)
|
Oid *rettype)
|
||||||
{
|
{
|
||||||
@ -3455,8 +3455,8 @@ exec_eval_expr(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
exec_run_select(PLpgSQL_execstate * estate,
|
exec_run_select(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr, int maxtuples, Portal *portalP)
|
PLpgSQL_expr *expr, int maxtuples, Portal *portalP)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Datum *values;
|
Datum *values;
|
||||||
@ -3535,8 +3535,8 @@ exec_run_select(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static Datum
|
static Datum
|
||||||
exec_eval_simple_expr(PLpgSQL_execstate * estate,
|
exec_eval_simple_expr(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_expr * expr,
|
PLpgSQL_expr *expr,
|
||||||
bool *isNull,
|
bool *isNull,
|
||||||
Oid *rettype)
|
Oid *rettype)
|
||||||
{
|
{
|
||||||
@ -3643,9 +3643,9 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_move_row(PLpgSQL_execstate * estate,
|
exec_move_row(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_rec * rec,
|
PLpgSQL_rec *rec,
|
||||||
PLpgSQL_row * row,
|
PLpgSQL_row *row,
|
||||||
HeapTuple tup, TupleDesc tupdesc)
|
HeapTuple tup, TupleDesc tupdesc)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -3769,8 +3769,8 @@ exec_move_row(PLpgSQL_execstate * estate,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static HeapTuple
|
static HeapTuple
|
||||||
make_tuple_from_row(PLpgSQL_execstate * estate,
|
make_tuple_from_row(PLpgSQL_execstate *estate,
|
||||||
PLpgSQL_row * row,
|
PLpgSQL_row *row,
|
||||||
TupleDesc tupdesc)
|
TupleDesc tupdesc)
|
||||||
{
|
{
|
||||||
int natts = tupdesc->natts;
|
int natts = tupdesc->natts;
|
||||||
@ -4127,7 +4127,7 @@ exec_simple_check_node(Node *node)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_simple_check_plan(PLpgSQL_expr * expr)
|
exec_simple_check_plan(PLpgSQL_expr *expr)
|
||||||
{
|
{
|
||||||
_SPI_plan *spi_plan = (_SPI_plan *) expr->plan;
|
_SPI_plan *spi_plan = (_SPI_plan *) expr->plan;
|
||||||
Plan *plan;
|
Plan *plan;
|
||||||
@ -4214,7 +4214,7 @@ compatible_tupdesc(TupleDesc td1, TupleDesc td2)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exec_set_found(PLpgSQL_execstate * estate, bool state)
|
exec_set_found(PLpgSQL_execstate *estate, bool state)
|
||||||
{
|
{
|
||||||
PLpgSQL_var *var;
|
PLpgSQL_var *var;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.35 2004/08/29 05:07:01 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.36 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -56,7 +56,7 @@ static bool ns_localmode = false;
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
plpgsql_dstring_init(PLpgSQL_dstring * ds)
|
plpgsql_dstring_init(PLpgSQL_dstring *ds)
|
||||||
{
|
{
|
||||||
ds->value = palloc(ds->alloc = 512);
|
ds->value = palloc(ds->alloc = 512);
|
||||||
ds->used = 0;
|
ds->used = 0;
|
||||||
@ -69,7 +69,7 @@ plpgsql_dstring_init(PLpgSQL_dstring * ds)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
plpgsql_dstring_free(PLpgSQL_dstring * ds)
|
plpgsql_dstring_free(PLpgSQL_dstring *ds)
|
||||||
{
|
{
|
||||||
pfree(ds->value);
|
pfree(ds->value);
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ plpgsql_dstring_free(PLpgSQL_dstring * ds)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
plpgsql_dstring_append(PLpgSQL_dstring * ds, char *str)
|
plpgsql_dstring_append(PLpgSQL_dstring *ds, char *str)
|
||||||
{
|
{
|
||||||
int len = strlen(str);
|
int len = strlen(str);
|
||||||
int needed = ds->used + len + 1;
|
int needed = ds->used + len + 1;
|
||||||
@ -105,7 +105,7 @@ plpgsql_dstring_append(PLpgSQL_dstring * ds, char *str)
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
plpgsql_dstring_get(PLpgSQL_dstring * ds)
|
plpgsql_dstring_get(PLpgSQL_dstring *ds)
|
||||||
{
|
{
|
||||||
return ds->value;
|
return ds->value;
|
||||||
}
|
}
|
||||||
@ -422,7 +422,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
|
|||||||
* Statement type as a string, for use in error messages etc.
|
* Statement type as a string, for use in error messages etc.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
plpgsql_stmt_typename(PLpgSQL_stmt * stmt)
|
plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
|
||||||
{
|
{
|
||||||
switch (stmt->cmd_type)
|
switch (stmt->cmd_type)
|
||||||
{
|
{
|
||||||
@ -478,28 +478,28 @@ plpgsql_stmt_typename(PLpgSQL_stmt * stmt)
|
|||||||
static int dump_indent;
|
static int dump_indent;
|
||||||
|
|
||||||
static void dump_ind();
|
static void dump_ind();
|
||||||
static void dump_stmt(PLpgSQL_stmt * stmt);
|
static void dump_stmt(PLpgSQL_stmt *stmt);
|
||||||
static void dump_block(PLpgSQL_stmt_block * block);
|
static void dump_block(PLpgSQL_stmt_block *block);
|
||||||
static void dump_assign(PLpgSQL_stmt_assign * stmt);
|
static void dump_assign(PLpgSQL_stmt_assign *stmt);
|
||||||
static void dump_if(PLpgSQL_stmt_if * stmt);
|
static void dump_if(PLpgSQL_stmt_if *stmt);
|
||||||
static void dump_loop(PLpgSQL_stmt_loop * stmt);
|
static void dump_loop(PLpgSQL_stmt_loop *stmt);
|
||||||
static void dump_while(PLpgSQL_stmt_while * stmt);
|
static void dump_while(PLpgSQL_stmt_while *stmt);
|
||||||
static void dump_fori(PLpgSQL_stmt_fori * stmt);
|
static void dump_fori(PLpgSQL_stmt_fori *stmt);
|
||||||
static void dump_fors(PLpgSQL_stmt_fors * stmt);
|
static void dump_fors(PLpgSQL_stmt_fors *stmt);
|
||||||
static void dump_select(PLpgSQL_stmt_select * stmt);
|
static void dump_select(PLpgSQL_stmt_select *stmt);
|
||||||
static void dump_exit(PLpgSQL_stmt_exit * stmt);
|
static void dump_exit(PLpgSQL_stmt_exit *stmt);
|
||||||
static void dump_return(PLpgSQL_stmt_return * stmt);
|
static void dump_return(PLpgSQL_stmt_return *stmt);
|
||||||
static void dump_return_next(PLpgSQL_stmt_return_next * stmt);
|
static void dump_return_next(PLpgSQL_stmt_return_next *stmt);
|
||||||
static void dump_raise(PLpgSQL_stmt_raise * stmt);
|
static void dump_raise(PLpgSQL_stmt_raise *stmt);
|
||||||
static void dump_execsql(PLpgSQL_stmt_execsql * stmt);
|
static void dump_execsql(PLpgSQL_stmt_execsql *stmt);
|
||||||
static void dump_dynexecute(PLpgSQL_stmt_dynexecute * stmt);
|
static void dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt);
|
||||||
static void dump_dynfors(PLpgSQL_stmt_dynfors * stmt);
|
static void dump_dynfors(PLpgSQL_stmt_dynfors *stmt);
|
||||||
static void dump_getdiag(PLpgSQL_stmt_getdiag * stmt);
|
static void dump_getdiag(PLpgSQL_stmt_getdiag *stmt);
|
||||||
static void dump_open(PLpgSQL_stmt_open * stmt);
|
static void dump_open(PLpgSQL_stmt_open *stmt);
|
||||||
static void dump_fetch(PLpgSQL_stmt_fetch * stmt);
|
static void dump_fetch(PLpgSQL_stmt_fetch *stmt);
|
||||||
static void dump_close(PLpgSQL_stmt_close * stmt);
|
static void dump_close(PLpgSQL_stmt_close *stmt);
|
||||||
static void dump_perform(PLpgSQL_stmt_perform * stmt);
|
static void dump_perform(PLpgSQL_stmt_perform *stmt);
|
||||||
static void dump_expr(PLpgSQL_expr * expr);
|
static void dump_expr(PLpgSQL_expr *expr);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -512,7 +512,7 @@ dump_ind()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_stmt(PLpgSQL_stmt * stmt)
|
dump_stmt(PLpgSQL_stmt *stmt)
|
||||||
{
|
{
|
||||||
printf("%3d:", stmt->lineno);
|
printf("%3d:", stmt->lineno);
|
||||||
switch (stmt->cmd_type)
|
switch (stmt->cmd_type)
|
||||||
@ -584,7 +584,7 @@ dump_stmt(PLpgSQL_stmt * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_stmts(PLpgSQL_stmts * stmts)
|
dump_stmts(PLpgSQL_stmts *stmts)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -595,7 +595,7 @@ dump_stmts(PLpgSQL_stmts * stmts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_block(PLpgSQL_stmt_block * block)
|
dump_block(PLpgSQL_stmt_block *block)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
@ -635,7 +635,7 @@ dump_block(PLpgSQL_stmt_block * block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_assign(PLpgSQL_stmt_assign * stmt)
|
dump_assign(PLpgSQL_stmt_assign *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("ASSIGN var %d := ", stmt->varno);
|
printf("ASSIGN var %d := ", stmt->varno);
|
||||||
@ -644,7 +644,7 @@ dump_assign(PLpgSQL_stmt_assign * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_if(PLpgSQL_stmt_if * stmt)
|
dump_if(PLpgSQL_stmt_if *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("IF ");
|
printf("IF ");
|
||||||
@ -663,7 +663,7 @@ dump_if(PLpgSQL_stmt_if * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_loop(PLpgSQL_stmt_loop * stmt)
|
dump_loop(PLpgSQL_stmt_loop *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("LOOP\n");
|
printf("LOOP\n");
|
||||||
@ -675,7 +675,7 @@ dump_loop(PLpgSQL_stmt_loop * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_while(PLpgSQL_stmt_while * stmt)
|
dump_while(PLpgSQL_stmt_while *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("WHILE ");
|
printf("WHILE ");
|
||||||
@ -689,7 +689,7 @@ dump_while(PLpgSQL_stmt_while * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_fori(PLpgSQL_stmt_fori * stmt)
|
dump_fori(PLpgSQL_stmt_fori *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("FORI %s %s\n", stmt->var->refname, (stmt->reverse) ? "REVERSE" : "NORMAL");
|
printf("FORI %s %s\n", stmt->var->refname, (stmt->reverse) ? "REVERSE" : "NORMAL");
|
||||||
@ -712,7 +712,7 @@ dump_fori(PLpgSQL_stmt_fori * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_fors(PLpgSQL_stmt_fors * stmt)
|
dump_fors(PLpgSQL_stmt_fors *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("FORS %s ", (stmt->rec != NULL) ? stmt->rec->refname : stmt->row->refname);
|
printf("FORS %s ", (stmt->rec != NULL) ? stmt->rec->refname : stmt->row->refname);
|
||||||
@ -726,7 +726,7 @@ dump_fors(PLpgSQL_stmt_fors * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_select(PLpgSQL_stmt_select * stmt)
|
dump_select(PLpgSQL_stmt_select *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("SELECT ");
|
printf("SELECT ");
|
||||||
@ -749,7 +749,7 @@ dump_select(PLpgSQL_stmt_select * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_open(PLpgSQL_stmt_open * stmt)
|
dump_open(PLpgSQL_stmt_open *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("OPEN curvar=%d\n", stmt->curvar);
|
printf("OPEN curvar=%d\n", stmt->curvar);
|
||||||
@ -781,7 +781,7 @@ dump_open(PLpgSQL_stmt_open * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_fetch(PLpgSQL_stmt_fetch * stmt)
|
dump_fetch(PLpgSQL_stmt_fetch *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("FETCH curvar=%d\n", stmt->curvar);
|
printf("FETCH curvar=%d\n", stmt->curvar);
|
||||||
@ -802,14 +802,14 @@ dump_fetch(PLpgSQL_stmt_fetch * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_close(PLpgSQL_stmt_close * stmt)
|
dump_close(PLpgSQL_stmt_close *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("CLOSE curvar=%d\n", stmt->curvar);
|
printf("CLOSE curvar=%d\n", stmt->curvar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_perform(PLpgSQL_stmt_perform * stmt)
|
dump_perform(PLpgSQL_stmt_perform *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("PERFORM expr = ");
|
printf("PERFORM expr = ");
|
||||||
@ -818,7 +818,7 @@ dump_perform(PLpgSQL_stmt_perform * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_exit(PLpgSQL_stmt_exit * stmt)
|
dump_exit(PLpgSQL_stmt_exit *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("EXIT lbl='%s'", stmt->label);
|
printf("EXIT lbl='%s'", stmt->label);
|
||||||
@ -831,7 +831,7 @@ dump_exit(PLpgSQL_stmt_exit * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_return(PLpgSQL_stmt_return * stmt)
|
dump_return(PLpgSQL_stmt_return *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("RETURN ");
|
printf("RETURN ");
|
||||||
@ -847,7 +847,7 @@ dump_return(PLpgSQL_stmt_return * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_return_next(PLpgSQL_stmt_return_next * stmt)
|
dump_return_next(PLpgSQL_stmt_return_next *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("RETURN NEXT ");
|
printf("RETURN NEXT ");
|
||||||
@ -861,7 +861,7 @@ dump_return_next(PLpgSQL_stmt_return_next * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_raise(PLpgSQL_stmt_raise * stmt)
|
dump_raise(PLpgSQL_stmt_raise *stmt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -873,7 +873,7 @@ dump_raise(PLpgSQL_stmt_raise * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_execsql(PLpgSQL_stmt_execsql * stmt)
|
dump_execsql(PLpgSQL_stmt_execsql *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("EXECSQL ");
|
printf("EXECSQL ");
|
||||||
@ -882,7 +882,7 @@ dump_execsql(PLpgSQL_stmt_execsql * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_dynexecute(PLpgSQL_stmt_dynexecute * stmt)
|
dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("EXECUTE ");
|
printf("EXECUTE ");
|
||||||
@ -891,7 +891,7 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_dynfors(PLpgSQL_stmt_dynfors * stmt)
|
dump_dynfors(PLpgSQL_stmt_dynfors *stmt)
|
||||||
{
|
{
|
||||||
dump_ind();
|
dump_ind();
|
||||||
printf("FORS %s EXECUTE ", (stmt->rec != NULL) ? stmt->rec->refname : stmt->row->refname);
|
printf("FORS %s EXECUTE ", (stmt->rec != NULL) ? stmt->rec->refname : stmt->row->refname);
|
||||||
@ -905,7 +905,7 @@ dump_dynfors(PLpgSQL_stmt_dynfors * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_getdiag(PLpgSQL_stmt_getdiag * stmt)
|
dump_getdiag(PLpgSQL_stmt_getdiag *stmt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -939,7 +939,7 @@ dump_getdiag(PLpgSQL_stmt_getdiag * stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_expr(PLpgSQL_expr * expr)
|
dump_expr(PLpgSQL_expr *expr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -959,7 +959,7 @@ dump_expr(PLpgSQL_expr * expr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
plpgsql_dumptree(PLpgSQL_function * func)
|
plpgsql_dumptree(PLpgSQL_function *func)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PLpgSQL_datum *d;
|
PLpgSQL_datum *d;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.52 2004/08/29 05:07:01 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.53 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -682,10 +682,10 @@ extern int plpgsql_parse_dblwordrowtype(char *word);
|
|||||||
extern PLpgSQL_type *plpgsql_parse_datatype(const char *string);
|
extern PLpgSQL_type *plpgsql_parse_datatype(const char *string);
|
||||||
extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod);
|
extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod);
|
||||||
extern PLpgSQL_variable *plpgsql_build_variable(char *refname, int lineno,
|
extern PLpgSQL_variable *plpgsql_build_variable(char *refname, int lineno,
|
||||||
PLpgSQL_type * dtype,
|
PLpgSQL_type *dtype,
|
||||||
bool add2namespace);
|
bool add2namespace);
|
||||||
extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
|
extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
|
||||||
extern void plpgsql_adddatum(PLpgSQL_datum * new);
|
extern void plpgsql_adddatum(PLpgSQL_datum *new);
|
||||||
extern int plpgsql_add_initdatums(int **varnos);
|
extern int plpgsql_add_initdatums(int **varnos);
|
||||||
extern void plpgsql_HashTableInit(void);
|
extern void plpgsql_HashTableInit(void);
|
||||||
|
|
||||||
@ -701,9 +701,9 @@ extern Datum plpgsql_validator(PG_FUNCTION_ARGS);
|
|||||||
* Functions in pl_exec.c
|
* Functions in pl_exec.c
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
extern Datum plpgsql_exec_function(PLpgSQL_function * func,
|
extern Datum plpgsql_exec_function(PLpgSQL_function *func,
|
||||||
FunctionCallInfo fcinfo);
|
FunctionCallInfo fcinfo);
|
||||||
extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function * func,
|
extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function *func,
|
||||||
TriggerData *trigdata);
|
TriggerData *trigdata);
|
||||||
extern void plpgsql_xact_cb(XactEvent event, TransactionId parentXid, void *arg);
|
extern void plpgsql_xact_cb(XactEvent event, TransactionId parentXid, void *arg);
|
||||||
|
|
||||||
@ -711,10 +711,10 @@ extern void plpgsql_xact_cb(XactEvent event, TransactionId parentXid, void *arg)
|
|||||||
* Functions for the dynamic string handling in pl_funcs.c
|
* Functions for the dynamic string handling in pl_funcs.c
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
extern void plpgsql_dstring_init(PLpgSQL_dstring * ds);
|
extern void plpgsql_dstring_init(PLpgSQL_dstring *ds);
|
||||||
extern void plpgsql_dstring_free(PLpgSQL_dstring * ds);
|
extern void plpgsql_dstring_free(PLpgSQL_dstring *ds);
|
||||||
extern void plpgsql_dstring_append(PLpgSQL_dstring * ds, char *str);
|
extern void plpgsql_dstring_append(PLpgSQL_dstring *ds, char *str);
|
||||||
extern char *plpgsql_dstring_get(PLpgSQL_dstring * ds);
|
extern char *plpgsql_dstring_get(PLpgSQL_dstring *ds);
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
* Functions for the namestack handling in pl_funcs.c
|
* Functions for the namestack handling in pl_funcs.c
|
||||||
@ -733,8 +733,8 @@ extern void plpgsql_ns_rename(char *oldname, char *newname);
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
extern void plpgsql_convert_ident(const char *s, char **output, int numidents);
|
extern void plpgsql_convert_ident(const char *s, char **output, int numidents);
|
||||||
extern const char *plpgsql_stmt_typename(PLpgSQL_stmt * stmt);
|
extern const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt);
|
||||||
extern void plpgsql_dumptree(PLpgSQL_function * func);
|
extern void plpgsql_dumptree(PLpgSQL_function *func);
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
* Externs in gram.y and scan.l
|
* Externs in gram.y and scan.l
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.54 2004/08/29 05:07:01 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.55 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
*********************************************************************
|
*********************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.90 2004/08/29 05:07:02 momjian Exp $
|
* $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.91 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -156,9 +156,9 @@ static ErrorData *pltcl_error_in_progress = NULL;
|
|||||||
* Forward declarations
|
* Forward declarations
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void pltcl_init_all(void);
|
static void pltcl_init_all(void);
|
||||||
static void pltcl_init_interp(Tcl_Interp * interp);
|
static void pltcl_init_interp(Tcl_Interp *interp);
|
||||||
|
|
||||||
static void pltcl_init_load_unknown(Tcl_Interp * interp);
|
static void pltcl_init_load_unknown(Tcl_Interp *interp);
|
||||||
|
|
||||||
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
|
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
|
||||||
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
|
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
|
||||||
@ -170,28 +170,28 @@ static HeapTuple pltcl_trigger_handler(PG_FUNCTION_ARGS);
|
|||||||
|
|
||||||
static pltcl_proc_desc *compile_pltcl_function(Oid fn_oid, Oid tgreloid);
|
static pltcl_proc_desc *compile_pltcl_function(Oid fn_oid, Oid tgreloid);
|
||||||
|
|
||||||
static int pltcl_elog(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_quote(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_argisnull(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_returnnull(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
|
|
||||||
static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_SPI_execp(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp * interp,
|
static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
|
|
||||||
static void pltcl_set_tuple_values(Tcl_Interp * interp, CONST84 char *arrayname,
|
static void pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
|
||||||
int tupno, HeapTuple tuple, TupleDesc tupdesc);
|
int tupno, HeapTuple tuple, TupleDesc tupdesc);
|
||||||
static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
|
static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
|
||||||
Tcl_DString * retval);
|
Tcl_DString *retval);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -292,7 +292,7 @@ pltcl_init_all(void)
|
|||||||
* pltcl_init_interp() - initialize a Tcl interpreter
|
* pltcl_init_interp() - initialize a Tcl interpreter
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void
|
static void
|
||||||
pltcl_init_interp(Tcl_Interp * interp)
|
pltcl_init_interp(Tcl_Interp *interp)
|
||||||
{
|
{
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Install the commands for SPI support in the interpreter
|
* Install the commands for SPI support in the interpreter
|
||||||
@ -322,7 +322,7 @@ pltcl_init_interp(Tcl_Interp * interp)
|
|||||||
* table pltcl_modules (if it exists)
|
* table pltcl_modules (if it exists)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void
|
static void
|
||||||
pltcl_init_load_unknown(Tcl_Interp * interp)
|
pltcl_init_load_unknown(Tcl_Interp *interp)
|
||||||
{
|
{
|
||||||
int spi_rc;
|
int spi_rc;
|
||||||
int tcl_rc;
|
int tcl_rc;
|
||||||
@ -1267,7 +1267,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
|
|||||||
* pltcl_elog() - elog() support for PLTcl
|
* pltcl_elog() - elog() support for PLTcl
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_elog(ClientData cdata, Tcl_Interp * interp,
|
pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
volatile int level;
|
volatile int level;
|
||||||
@ -1339,7 +1339,7 @@ pltcl_elog(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* be used in SPI_exec query strings
|
* be used in SPI_exec query strings
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_quote(ClientData cdata, Tcl_Interp * interp,
|
pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@ -1392,7 +1392,7 @@ pltcl_quote(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* pltcl_argisnull() - determine if a specific argument is NULL
|
* pltcl_argisnull() - determine if a specific argument is NULL
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_argisnull(ClientData cdata, Tcl_Interp * interp,
|
pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int argno;
|
int argno;
|
||||||
@ -1449,7 +1449,7 @@ pltcl_argisnull(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* pltcl_returnnull() - Cause a NULL return from a function
|
* pltcl_returnnull() - Cause a NULL return from a function
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_returnnull(ClientData cdata, Tcl_Interp * interp,
|
pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
|
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
|
||||||
@ -1488,7 +1488,7 @@ pltcl_returnnull(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* for the Tcl interpreter
|
* for the Tcl interpreter
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_exec(ClientData cdata, Tcl_Interp * interp,
|
pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
volatile int my_rc;
|
volatile int my_rc;
|
||||||
@ -1696,7 +1696,7 @@ pltcl_SPI_exec(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* and not save the plan currently.
|
* and not save the plan currently.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
|
pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int nargs;
|
int nargs;
|
||||||
@ -1843,7 +1843,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* pltcl_SPI_execp() - Execute a prepared plan
|
* pltcl_SPI_execp() - Execute a prepared plan
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_execp(ClientData cdata, Tcl_Interp * interp,
|
pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
volatile int my_rc;
|
volatile int my_rc;
|
||||||
@ -2168,7 +2168,7 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* be used after insert queries
|
* be used after insert queries
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp * interp,
|
pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, CONST84 char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
@ -2184,7 +2184,7 @@ pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp * interp,
|
|||||||
* of a given tuple
|
* of a given tuple
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void
|
static void
|
||||||
pltcl_set_tuple_values(Tcl_Interp * interp, CONST84 char *arrayname,
|
pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
|
||||||
int tupno, HeapTuple tuple, TupleDesc tupdesc)
|
int tupno, HeapTuple tuple, TupleDesc tupdesc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -2281,7 +2281,7 @@ pltcl_set_tuple_values(Tcl_Interp * interp, CONST84 char *arrayname,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void
|
static void
|
||||||
pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
|
pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
|
||||||
Tcl_DString * retval)
|
Tcl_DString *retval)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *outputstr;
|
char *outputstr;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.23 2004/08/29 05:07:02 momjian Exp $
|
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.24 2004/08/30 02:54:42 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -792,8 +792,8 @@ static const struct
|
|||||||
"Australia/Perth"
|
"Australia/Perth"
|
||||||
}, /* (GMT+08:00) Perth */
|
}, /* (GMT+08:00) Perth */
|
||||||
/* {"W. Central Africa Standard Time", "W. Central Africa Daylight Time",
|
/* {"W. Central Africa Standard Time", "W. Central Africa Daylight Time",
|
||||||
* ""}, Could not find a match for this one. Excluded for now. *//* (G
|
* * ""}, Could not find a match for this one. Excluded for now. *//* (
|
||||||
* MT+01:00) West Central Africa */
|
* G MT+01:00) West Central Africa */
|
||||||
{
|
{
|
||||||
"W. Europe Standard Time", "W. Europe Daylight Time",
|
"W. Europe Standard Time", "W. Europe Daylight Time",
|
||||||
"CET"
|
"CET"
|
||||||
|
@ -108,7 +108,6 @@ do
|
|||||||
-TAES_KEY \
|
-TAES_KEY \
|
||||||
-TAMT \
|
-TAMT \
|
||||||
-TAMTS \
|
-TAMTS \
|
||||||
-TANY \
|
|
||||||
-TASN1_BIT_STRING \
|
-TASN1_BIT_STRING \
|
||||||
-TASN1_BMPSTRING \
|
-TASN1_BMPSTRING \
|
||||||
-TASN1_BOOLEAN \
|
-TASN1_BOOLEAN \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user