diff options
| author | Bruce Momjian <bruce@momjian.us> | 2004-08-30 02:54:42 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2004-08-30 02:54:42 +0000 |
| commit | 15d3f9f6b7849a70281f151f0def7a6d335767d7 (patch) | |
| tree | 98d285e17c671a56e484e98916703280e1947a78 /src/backend | |
| parent | 166300f318f5b4795c0f7679144a1c23c0118163 (diff) | |
| download | postgresql-15d3f9f6b7849a70281f151f0def7a6d335767d7.tar.gz | |
Another pgindent run with lib typedefs added.
Diffstat (limited to 'src/backend')
24 files changed, 270 insertions, 223 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 3bb38e4227..c0ef2ca763 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -10,7 +10,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -1704,7 +1704,7 @@ CommitTransactionCommand(void) AbortOutOfAnyTransaction(); s = CurrentTransactionState; /* changed by * AbortOutOfAnyTransaction - * */ + * */ /* AbortOutOfAnyTransaction sets the blockState */ break; diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e8f9ea20de..f05e083066 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * 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 * 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 - * all "normal" records, but very large commit or abort records might - * need more space.) + * sure it's at least 4*BLCKSZ to start with. (That is enough for all + * "normal" records, but very large commit or abort records might need + * more space.) */ if (total_len > readRecordBufSize) { diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index aa95d97d0e..38696cf707 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -9,7 +9,7 @@ * * * 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,24 +1117,27 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record) xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) XLogRecGetData(record); char *dst_path = xlrec->src_path + strlen(xlrec->src_path) + 1; struct stat st; + #ifndef WIN32 char buf[2 * MAXPGPATH + 100]; #endif /* - * Our theory for replaying a CREATE is to forcibly drop the target - * subdirectory if present, then re-copy the source data. This - * may be more work than needed, but it is simple to implement. + * Our theory for replaying a CREATE is to forcibly drop the + * target subdirectory if present, then re-copy the source data. + * 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 (!rmtree(dst_path, true)) ereport(WARNING, - (errmsg("could not remove database directory \"%s\"", - dst_path))); + (errmsg("could not remove database directory \"%s\"", + dst_path))); } #ifndef WIN32 + /* * 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); - /* 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); if (!rmtree(xlrec->dir_path, true)) diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 3b44ebb19f..b9fbd2b5ea 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -45,7 +45,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -146,27 +146,27 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo) /* OK, go for it */ if (mkdir(dir, S_IRWXU) < 0) { - char *parentdir; + char *parentdir; if (errno != ENOENT || !isRedo) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - dir))); + errmsg("could not create directory \"%s\": %m", + dir))); /* Try to make parent directory too */ parentdir = pstrdup(dir); get_parent_directory(parentdir); if (mkdir(parentdir, S_IRWXU) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - parentdir))); + errmsg("could not create directory \"%s\": %m", + parentdir))); pfree(parentdir); if (mkdir(dir, S_IRWXU) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - dir))); + errmsg("could not create directory \"%s\": %m", + dir))); } } @@ -444,7 +444,8 @@ DropTableSpace(DropTableSpaceStmt *stmt) 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); @@ -598,8 +599,8 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo) /* * Okay, try to remove the symlink. We must however deal with the * possibility that it's a directory instead of a symlink --- this - * could happen during WAL replay (see TablespaceCreateDbspace), - * and it is also the normal case on Windows. + * could happen during WAL replay (see TablespaceCreateDbspace), and + * it is also the normal case on Windows. */ if (lstat(location, &st) == 0 && S_ISDIR(st.st_mode)) { @@ -959,14 +960,14 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record) char *linkloc; /* - * Attempt to coerce target directory to safe permissions. If this - * fails, it doesn't exist or has the wrong owner. + * Attempt to coerce target directory to safe permissions. If + * this fails, it doesn't exist or has the wrong owner. */ if (chmod(location, 0700) != 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not set permissions on directory \"%s\": %m", - location))); + errmsg("could not set permissions on directory \"%s\": %m", + location))); /* Create or re-create the PG_VERSION file in the target directory */ set_short_version(location); @@ -980,8 +981,8 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record) if (errno != EEXIST) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create symbolic link \"%s\": %m", - linkloc))); + errmsg("could not create symbolic link \"%s\": %m", + linkloc))); } pfree(linkloc); diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 67c1c02b6d..8ace2777d4 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * 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)) { /* - * There cannot be another concurrently running VACUUM. - * If the tuple had been moved in by a previous VACUUM, - * the visibility check would have set XMIN_COMMITTED. If - * the tuple had been moved in by the currently running + * There cannot be another concurrently running VACUUM. If + * the tuple had been moved in by a previous VACUUM, the + * visibility check would have set XMIN_COMMITTED. If the + * tuple had been moved in by the currently running * VACUUM, the loop would have been terminated. We had * elog(ERROR, ...) here, but as we are testing for a * can't-happen condition, Assert() seems more diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index cb4a3cde71..f262754a56 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * 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), ObjectIdGetDatum(InvalidOid), Int32GetDatum(-1))); + pfree(val); 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 */ CTimeZone = -interval->time; + HasCTZSet = true; } pfree(interval); @@ -448,10 +450,10 @@ show_timezone(void) if (HasCTZSet) { - Interval interval; + Interval interval; - interval.month = 0; - interval.time = -CTimeZone; + interval. month = 0; + interval. time = -CTimeZone; tzn = DatumGetCString(DirectFunctionCall1(interval_out, IntervalPGetDatum(&interval))); diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index a6898e75c8..d8f228f2b9 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -8,7 +8,7 @@ * * * 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. * (We don't want to do this before eval_const_expressions, since the - * latter would be unable to simplify a top-level AND correctly. - * Also, SS_process_sublinks expects explicit-AND format.) + * latter would be unable to simplify a top-level AND correctly. Also, + * SS_process_sublinks expects explicit-AND format.) */ if (kind == EXPRKIND_QUAL) expr = (Node *) make_ands_implicit((Expr *) expr); diff --git a/src/backend/port/beos/support.c b/src/backend/port/beos/support.c index 86053d79c0..a5f237e43b 100644 --- a/src/backend/port/beos/support.c +++ b/src/backend/port/beos/support.c @@ -168,7 +168,7 @@ beos_startup(int argc, char **argv) /* Main server loop */ for (;;) { - int32 opcode = 0; + int32 opcode = 0; char datas[4000]; /* diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c index de84e45f2b..4835f4eab3 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * * 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 $ * *------------------------------------------------------------------------- */ @@ -33,15 +33,15 @@ TranslateSocketError(void) { switch (WSAGetLastError()) { - case WSANOTINITIALISED: - case WSAENETDOWN: - case WSAEINPROGRESS: - case WSAEINVAL: - case WSAESOCKTNOSUPPORT: - case WSAEFAULT: - case WSAEINVALIDPROVIDER: - case WSAEINVALIDPROCTABLE: - case WSAEMSGSIZE: + case WSANOTINITIALISED: + case WSAENETDOWN: + case WSAEINPROGRESS: + case WSAEINVAL: + case WSAESOCKTNOSUPPORT: + case WSAEFAULT: + case WSAEINVALIDPROVIDER: + case WSAEINVALIDPROCTABLE: + case WSAEMSGSIZE: errno = EINVAL; break; case WSAEAFNOSUPPORT: diff --git a/src/backend/storage/lmgr/s_lock.c b/src/backend/storage/lmgr/s_lock.c index 8377e103eb..b81a7e67e5 100644 --- a/src/backend/storage/lmgr/s_lock.c +++ b/src/backend/storage/lmgr/s_lock.c @@ -9,7 +9,7 @@ * * * 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"); } #endif /* __sparc || __sparc__ */ - #endif /* not __GNUC__ */ #endif /* HAVE_SPINLOCKS */ diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 54e56061cf..6e7ebed875 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -8,7 +8,7 @@ * * * 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 * the best solution. It ensures that the open file reference * isn't permanently leaked if we get an error here. (You may - * say "but an unreferenced SMgrRelation is still a leak!" - * Not really, because the only case in which a checkpoint is - * done by a process that isn't about to shut down is in the + * say "but an unreferenced SMgrRelation is still a leak!" Not + * really, because the only case in which a checkpoint is done + * by a process that isn't about to shut down is in the * bgwriter, and it will periodically do smgrcloseall(). This * fact justifies our not closing the reln in the success path * either, which is a good thing since in non-bgwriter cases diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index ec1d902a10..71e82d71ed 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -11,7 +11,7 @@ * * * 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; /* - * Make a non-transactional XLOG entry showing the file creation. - * It's non-transactional because we should replay it whether the + * Make a non-transactional XLOG entry showing the file creation. It's + * non-transactional because we should replay it whether the * transaction commits or not; if not, the file will be dropped at * abort time. */ diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index fcded9b763..66f5fd8cfe 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -8,7 +8,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -55,7 +55,7 @@ Datum date_in(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); - DateADT date; + DateADT date; fsec_t fsec; struct pg_tm tt, *tm = &tt; @@ -109,13 +109,13 @@ date_in(PG_FUNCTION_ARGS) Datum date_out(PG_FUNCTION_ARGS) { - DateADT date = PG_GETARG_DATEADT(0); + DateADT date = PG_GETARG_DATEADT(0); char *result; struct pg_tm tt, *tm = &tt; char buf[MAXDATELEN + 1]; - j2date(date + POSTGRES_EPOCH_JDATE, + j2date(date +POSTGRES_EPOCH_JDATE, &(tm->tm_year), &(tm->tm_mon), &(tm->tm_mday)); EncodeDateOnly(tm, DateStyle, buf); @@ -141,7 +141,7 @@ date_recv(PG_FUNCTION_ARGS) Datum date_send(PG_FUNCTION_ARGS) { - DateADT date = PG_GETARG_DATEADT(0); + DateADT date = PG_GETARG_DATEADT(0); StringInfoData buf; pq_begintypsend(&buf); @@ -717,7 +717,7 @@ date_timestamp(PG_FUNCTION_ARGS) Datum timestamp_date(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); DateADT result; struct pg_tm tt, *tm = &tt; @@ -726,7 +726,7 @@ timestamp_date(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) PG_RETURN_NULL(); - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -769,7 +769,7 @@ timestamptz_date(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) PG_RETURN_NULL(); - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -823,7 +823,7 @@ Datum date_text(PG_FUNCTION_ARGS) { /* Input is a Date, but may as well leave it in Datum form */ - Datum date = PG_GETARG_DATUM(0); + Datum date = PG_GETARG_DATUM(0); text *result; char *str; int len; @@ -1322,7 +1322,7 @@ overlaps_time(PG_FUNCTION_ARGS) Datum timestamp_time(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); TimeADT result; struct pg_tm tt, *tm = &tt; @@ -1331,7 +1331,7 @@ timestamp_time(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) PG_RETURN_NULL(); - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -1368,7 +1368,7 @@ timestamptz_time(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) PG_RETURN_NULL(); - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -1394,7 +1394,7 @@ timestamptz_time(PG_FUNCTION_ARGS) Datum datetime_timestamp(PG_FUNCTION_ARGS) { - DateADT date = PG_GETARG_DATEADT(0); + DateADT date = PG_GETARG_DATEADT(0); TimeADT time = PG_GETARG_TIMEADT(1); Timestamp result; @@ -2246,7 +2246,7 @@ timestamptz_timetz(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) PG_RETURN_NULL(); - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -2268,15 +2268,15 @@ timestamptz_timetz(PG_FUNCTION_ARGS) Datum datetimetz_timestamptz(PG_FUNCTION_ARGS) { - DateADT date = PG_GETARG_DATEADT(0); + DateADT date = PG_GETARG_DATEADT(0); TimeTzADT *time = PG_GETARG_TIMETZADT_P(1); TimestampTz result; #ifdef HAVE_INT64_TIMESTAMP - result = (((date * INT64CONST(86400000000)) + time->time) + result = (((date *INT64CONST(86400000000)) +time->time) + (time->zone * INT64CONST(1000000))); #else - result = (((date * 86400.0) + time->time) + time->zone); + result = (((date *86400.0) +time->time) + time->zone); #endif PG_RETURN_TIMESTAMP(result); diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 6e0311d8ae..4459d286c9 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * 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; day = date; + day += 1; day %= 7; @@ -1585,7 +1586,7 @@ int DetermineLocalTimeZone(struct pg_tm * tm) { int tz; - int date, + int date , sec; pg_time_t day, mysec, @@ -1609,7 +1610,8 @@ DetermineLocalTimeZone(struct pg_tm * tm) if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday)) goto overflow; 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) goto overflow; sec = tm->tm_sec + (tm->tm_min + tm->tm_hour * 60) * 60; diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 13c23bb57a..369353e6ce 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * 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 @@ -3556,6 +3556,7 @@ NUM_prepare_locale(NUMProc *Np) */ if (lconv->decimal_point && *lconv->decimal_point) Np->decimal = lconv->decimal_point; + else Np->decimal = "."; @@ -3579,6 +3580,7 @@ NUM_prepare_locale(NUMProc *Np) Np->L_negative_sign = "-"; Np->L_positive_sign = "+"; Np->decimal = "."; + Np->L_thousands_sep = ","; Np->L_currency_symbol = " "; } diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 4a2e862fb7..09c5b66129 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -10,7 +10,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -547,7 +547,7 @@ btabstimecmp(PG_FUNCTION_ARGS) Datum timestamp_abstime(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); AbsoluteTime result; fsec_t fsec; int tz; @@ -816,6 +816,7 @@ tintervalin(PG_FUNCTION_ARGS) t2; interval = (TimeInterval) palloc(sizeof(TimeIntervalData)); + if (istinterval(intervalstr, &t1, &t2) == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), @@ -823,14 +824,15 @@ tintervalin(PG_FUNCTION_ARGS) intervalstr))); if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) - interval->status = T_INTERVAL_INVAL; /* undefined */ + interval ->status = T_INTERVAL_INVAL; /* undefined */ + else - interval->status = T_INTERVAL_VALID; + interval ->status = T_INTERVAL_VALID; i_start = ABSTIMEMIN(t1, t2); i_end = ABSTIMEMAX(t1, t2); - interval->data[0] = i_start; - interval->data[1] = i_end; + interval ->data[0] = i_start; + interval ->data[1] = i_end; PG_RETURN_TIMEINTERVAL(interval); } @@ -877,15 +879,16 @@ tintervalrecv(PG_FUNCTION_ARGS) 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 || interval->status == T_INTERVAL_VALID)) ereport(ERROR, (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), errmsg("invalid status in external \"tinterval\" value"))); - interval->data[0] = pq_getmsgint(buf, sizeof(interval->data[0])); - interval->data[1] = pq_getmsgint(buf, sizeof(interval->data[1])); + interval ->data[0] = pq_getmsgint(buf, sizeof(interval->data[0])); + interval ->data[1] = pq_getmsgint(buf, sizeof(interval->data[1])); PG_RETURN_TIMEINTERVAL(interval); } @@ -931,7 +934,7 @@ interval_reltime(PG_FUNCTION_ARGS) year = 0; month = 0; } - else if (abs(interval->month) >= 12) + else if (abs(interval->month) >=12) { year = (interval->month / 12); month = (interval->month % 12); @@ -1016,12 +1019,13 @@ mktinterval(PG_FUNCTION_ARGS) interval = (TimeInterval) palloc(sizeof(TimeIntervalData)); if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) - interval->status = T_INTERVAL_INVAL; + interval ->status = T_INTERVAL_INVAL; + else { - interval->status = T_INTERVAL_VALID; - interval->data[0] = tstart; - interval->data[1] = tend; + interval ->status = T_INTERVAL_VALID; + interval ->data[0] = tstart; + interval ->data[1] = tend; } PG_RETURN_TIMEINTERVAL(interval); diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 9c312643c5..9c8abfb365 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -14,7 +14,7 @@ * Copyright (c) 1998-2004, PostgreSQL Global Development Group * * 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. */ Datum -numeric(PG_FUNCTION_ARGS) +numeric (PG_FUNCTION_ARGS) { Numeric num = PG_GETARG_NUMERIC(0); int32 typmod = PG_GETARG_INT32(1); diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index b1f66d9c9a..412a0a3231 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * 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))); #else 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 } case RELTIMEOID: @@ -2770,7 +2770,7 @@ convert_timevalue_to_scalar(Datum value, Oid typid) #ifdef HAVE_INT64_TIMESTAMP if (interval->status != 0) - return ((interval->data[1] - interval->data[0]) * 1000000.0); + return ((interval->data[1] - interval->data[0]) *1000000.0); #else if (interval->status != 0) return interval->data[1] - interval->data[0]; diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 375ff13068..83286502e8 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -8,7 +8,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -135,7 +135,7 @@ timestamp_in(PG_FUNCTION_ARGS) Datum timestamp_out(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); char *result; struct pg_tm tt, *tm = &tt; @@ -166,13 +166,14 @@ Datum timestamp_recv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); - Timestamp timestamp; + Timestamp timestamp; struct pg_tm tt, *tm = &tt; fsec_t fsec; #ifdef HAVE_INT64_TIMESTAMP timestamp = (Timestamp) pq_getmsgint64(buf); + #else timestamp = (Timestamp) pq_getmsgfloat8(buf); #endif @@ -180,7 +181,7 @@ timestamp_recv(PG_FUNCTION_ARGS) /* rangecheck: see if timestamp_out would like it */ if (TIMESTAMP_NOT_FINITE(timestamp)) /* ok */ ; - else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -194,7 +195,7 @@ timestamp_recv(PG_FUNCTION_ARGS) Datum timestamp_send(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); StringInfoData buf; pq_begintypsend(&buf); @@ -214,7 +215,7 @@ timestamp_send(PG_FUNCTION_ARGS) Datum timestamp_scale(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); int32 typmod = PG_GETARG_INT32(1); Timestamp result; @@ -416,6 +417,7 @@ timestamptz_recv(PG_FUNCTION_ARGS) #ifdef HAVE_INT64_TIMESTAMP timestamp = (TimestampTz) pq_getmsgint64(buf); + #else timestamp = (TimestampTz) pq_getmsgfloat8(buf); #endif @@ -423,7 +425,7 @@ timestamptz_recv(PG_FUNCTION_ARGS) /* rangecheck: see if timestamptz_out would like it */ if (TIMESTAMP_NOT_FINITE(timestamp)) /* ok */ ; - else if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + else if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -577,11 +579,12 @@ interval_recv(PG_FUNCTION_ARGS) interval = (Interval *) palloc(sizeof(Interval)); #ifdef HAVE_INT64_TIMESTAMP - interval->time = pq_getmsgint64(buf); + interval ->time = pq_getmsgint64(buf); + #else - interval->time = pq_getmsgfloat8(buf); + interval ->time = pq_getmsgfloat8(buf); #endif - interval->month = pq_getmsgint(buf, sizeof(interval->month)); + interval ->month = pq_getmsgint(buf, sizeof(interval->month)); PG_RETURN_INTERVAL_P(interval); } @@ -676,25 +679,28 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) } else if (range == INTERVAL_MASK(YEAR)) { - interval->month = ((interval->month / 12) * 12); - interval->time = 0; + interval ->month = ((interval->month / 12) *12); + interval ->time = 0; } else if (range == INTERVAL_MASK(MONTH)) { - interval->month %= 12; - interval->time = 0; + interval ->month %= 12; + interval ->time = 0; } /* YEAR TO MONTH */ else if (range == (INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH))) - interval->time = 0; + interval ->time = 0; + else if (range == INTERVAL_MASK(DAY)) { - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP - interval->time = (((int) (interval->time / INT64CONST(86400000000))) - * INT64CONST(86400000000)); + interval ->time = (((int) (interval->time / INT64CONST(86400000000))) + * INT64CONST(86400000000)); + #else - interval->time = (((int) (interval->time / 86400)) * 86400); + interval ->time = (((int) (interval->time / 86400)) * 86400); #endif } else if (range == INTERVAL_MASK(HOUR)) @@ -706,15 +712,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) double day; #endif - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP day = (interval->time / INT64CONST(86400000000)); - interval->time -= (day * INT64CONST(86400000000)); - interval->time = ((interval->time / INT64CONST(3600000000)) - * INT64CONST(3600000000)); + interval ->time -= (day * INT64CONST(86400000000)); + interval ->time = ((interval->time / INT64CONST(3600000000)) + *INT64CONST(3600000000)); + #else TMODULO(interval->time, day, 86400.0); - interval->time = (((int) (interval->time / 3600)) * 3600.0); + interval ->time = (((int) (interval->time / 3600)) * 3600.0); #endif } else if (range == INTERVAL_MASK(MINUTE)) @@ -726,15 +734,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) double hour; #endif - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP hour = (interval->time / INT64CONST(3600000000)); - interval->time -= (hour * INT64CONST(3600000000)); - interval->time = ((interval->time / INT64CONST(60000000)) - * INT64CONST(60000000)); + interval ->time -= (hour * INT64CONST(3600000000)); + interval ->time = ((interval->time / INT64CONST(60000000)) + *INT64CONST(60000000)); + #else TMODULO(interval->time, hour, 3600.0); - interval->time = (((int) (interval->time / 60)) * 60); + interval ->time = (((int) (interval->time / 60)) * 60); #endif } else if (range == INTERVAL_MASK(SECOND)) @@ -746,10 +756,12 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) double minute; #endif - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP minute = (interval->time / INT64CONST(60000000)); - interval->time -= (minute * INT64CONST(60000000)); + interval ->time -= (minute * INT64CONST(60000000)); + #else TMODULO(interval->time, minute, 60.0); /* interval->time = (int)(interval->time); */ @@ -759,12 +771,14 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) else if (range == (INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR))) { - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP - interval->time = ((interval->time / INT64CONST(3600000000)) - * INT64CONST(3600000000)); + interval ->time = ((interval->time / INT64CONST(3600000000)) + *INT64CONST(3600000000)); + #else - interval->time = (((int) (interval->time / 3600)) * 3600); + interval ->time = (((int) (interval->time / 3600)) * 3600); #endif } /* DAY TO MINUTE */ @@ -772,12 +786,14 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE))) { - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP - interval->time = ((interval->time / INT64CONST(60000000)) - * INT64CONST(60000000)); + interval ->time = ((interval->time / INT64CONST(60000000)) + *INT64CONST(60000000)); + #else - interval->time = (((int) (interval->time / 60)) * 60); + interval ->time = (((int) (interval->time / 60)) * 60); #endif } /* DAY TO SECOND */ @@ -785,7 +801,8 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND))) - interval->month = 0; + interval ->month = 0; + /* HOUR TO MINUTE */ else if (range == (INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE))) @@ -797,15 +814,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) double day; #endif - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP day = (interval->time / INT64CONST(86400000000)); - interval->time -= (day * INT64CONST(86400000000)); - interval->time = ((interval->time / INT64CONST(60000000)) - * INT64CONST(60000000)); + interval ->time -= (day * INT64CONST(86400000000)); + interval ->time = ((interval->time / INT64CONST(60000000)) + *INT64CONST(60000000)); + #else TMODULO(interval->time, day, 86400.0); - interval->time = (((int) (interval->time / 60)) * 60); + interval ->time = (((int) (interval->time / 60)) * 60); #endif } /* HOUR TO SECOND */ @@ -820,10 +839,12 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) double day; #endif - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP day = (interval->time / INT64CONST(86400000000)); - interval->time -= (day * INT64CONST(86400000000)); + interval ->time -= (day * INT64CONST(86400000000)); + #else TMODULO(interval->time, day, 86400.0); #endif @@ -839,10 +860,12 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) double hour; #endif - interval->month = 0; + interval ->month = 0; + #ifdef HAVE_INT64_TIMESTAMP hour = (interval->time / INT64CONST(3600000000)); - interval->time -= (hour * INT64CONST(3600000000)); + interval ->time -= (hour * INT64CONST(3600000000)); + #else TMODULO(interval->time, hour, 3600.0); #endif @@ -870,17 +893,17 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) #ifdef HAVE_INT64_TIMESTAMP if (interval->time >= INT64CONST(0)) { - interval->time = (((interval->time + IntervalOffsets[precision]) / IntervalScales[precision]) - * IntervalScales[precision]); + interval ->time = (((interval->time + IntervalOffsets[precision]) /IntervalScales[precision]) + * IntervalScales[precision]); } else { - interval->time = -(((-interval->time + IntervalOffsets[precision]) / IntervalScales[precision]) - * IntervalScales[precision]); + interval ->time = -(((-interval->time + IntervalOffsets[precision]) /IntervalScales[precision]) + * IntervalScales[precision]); } #else - interval->time = (rint(((double) interval->time) * IntervalScales[precision]) - / IntervalScales[precision]); + interval ->time = (rint(((double) interval->time) *IntervalScales[precision]) + / IntervalScales[precision]); #endif } } @@ -963,7 +986,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec) int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, char **tzn) { - Timestamp date; + Timestamp date; Timestamp time; pg_time_t utime; @@ -988,7 +1011,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, char **tzn if (time < INT64CONST(0)) { time += INT64CONST(86400000000); - date -= 1; + date -=1; } #else 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) { time += 86400; - date -= 1; + date -=1; } #endif /* 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 */ - if (date < 0 || date > (Timestamp) INT_MAX) + if (date <0 || date >(Timestamp) INT_MAX) return -1; j2date((int) date, &tm->tm_year, &tm->tm_mon, &tm->tm_mday); @@ -1100,11 +1123,11 @@ int tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) { #ifdef HAVE_INT64_TIMESTAMP - int date; + int date; int64 time; #else - double date, + double date, time; #endif @@ -1113,17 +1136,18 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) return -1; 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); #ifdef HAVE_INT64_TIMESTAMP - *result = (date * INT64CONST(86400000000)) + time; + *result = (date *INT64CONST(86400000000)) +time; /* check for major overflow */ if ((*result - time) / INT64CONST(86400000000) != date) return -1; /* 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; #else - *result = ((date * 86400) + time); + *result = ((date *86400) +time); #endif if (tzp != NULL) *result = dt2local(*result, -(*tzp)); @@ -1235,7 +1259,7 @@ dt2local(Timestamp dt, int tz) Datum timestamp_finite(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); PG_RETURN_BOOL(!TIMESTAMP_NOT_FINITE(timestamp)); } @@ -1884,12 +1908,13 @@ timestamp_mi(PG_FUNCTION_ARGS) Datum timestamp_pl_interval(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); Interval *span = PG_GETARG_INTERVAL_P(1); Timestamp result; if (TIMESTAMP_NOT_FINITE(timestamp)) result = timestamp; + else { if (span->month != 0) @@ -1898,7 +1923,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS) *tm = &tt; fsec_t fsec; - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_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]) 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, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); } - timestamp += span->time; + timestamp +=span->time; result = timestamp; } @@ -1935,7 +1960,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS) Datum timestamp_mi_interval(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); Interval *span = PG_GETARG_INTERVAL_P(1); Interval tspan; @@ -1968,6 +1993,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) result = timestamp; + else { if (span->month != 0) @@ -1976,7 +2002,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS) *tm = &tt; fsec_t fsec; - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -1999,13 +2025,13 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS) tz = DetermineLocalTimeZone(tm); - if (tm2timestamp(tm, fsec, &tz, ×tamp) != 0) + if (tm2timestamp(tm, fsec, &tz, ×tamp) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); } - timestamp += span->time; + timestamp +=span->time; result = timestamp; } @@ -2513,7 +2539,7 @@ Datum timestamp_text(PG_FUNCTION_ARGS) { /* Input is a Timestamp, but may as well leave it in Datum form */ - Datum timestamp = PG_GETARG_DATUM(0); + Datum timestamp = PG_GETARG_DATUM(0); text *result; char *str; int len; @@ -2574,7 +2600,7 @@ Datum timestamptz_text(PG_FUNCTION_ARGS) { /* Input is a Timestamp, but may as well leave it in Datum form */ - Datum timestamp = PG_GETARG_DATUM(0); + Datum timestamp = PG_GETARG_DATUM(0); text *result; char *str; int len; @@ -2694,7 +2720,7 @@ Datum timestamp_trunc(PG_FUNCTION_ARGS) { text *units = PG_GETARG_TEXT_P(0); - Timestamp timestamp = PG_GETARG_TIMESTAMP(1); + Timestamp timestamp = PG_GETARG_TIMESTAMP(1); Timestamp result; int type, val; @@ -2714,7 +2740,7 @@ timestamp_trunc(PG_FUNCTION_ARGS) if (type == UNITS) { - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -2833,7 +2859,7 @@ timestamptz_trunc(PG_FUNCTION_ARGS) if (type == UNITS) { - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3175,7 +3201,7 @@ Datum timestamp_part(PG_FUNCTION_ARGS) { text *units = PG_GETARG_TEXT_P(0); - Timestamp timestamp = PG_GETARG_TIMESTAMP(1); + Timestamp timestamp = PG_GETARG_TIMESTAMP(1); float8 result; int type, val; @@ -3200,7 +3226,7 @@ timestamp_part(PG_FUNCTION_ARGS) if (type == UNITS) { - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3279,9 +3305,9 @@ timestamp_part(PG_FUNCTION_ARGS) case DTK_CENTURY: /* - * centuries AD, c>0: year in [ (c-1)*100+1 : c*100 - * ] centuries BC, c<0: year in [ c*100 : - * (c+1)*100-1 ] there is no number 0 century. + * centuries AD, c>0: year in [ (c-1)*100+1 : c*100 ] + * centuries BC, c<0: year in [ c*100 : (c+1)*100-1 + * ] there is no number 0 century. */ if (tm->tm_year > 0) result = ((tm->tm_year + 99) / 100); @@ -3333,7 +3359,7 @@ timestamp_part(PG_FUNCTION_ARGS) * convert to timestamptz to produce consistent * results */ - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3353,7 +3379,7 @@ timestamp_part(PG_FUNCTION_ARGS) break; } case DTK_DOW: - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3361,7 +3387,7 @@ timestamp_part(PG_FUNCTION_ARGS) break; case DTK_DOY: - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3424,7 +3450,7 @@ timestamptz_part(PG_FUNCTION_ARGS) if (type == UNITS) { - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3548,14 +3574,14 @@ timestamptz_part(PG_FUNCTION_ARGS) { case DTK_EPOCH: #ifdef HAVE_INT64_TIMESTAMP - result = ((timestamp - SetEpochTimestamp()) / 1000000e0); + result = ((timestamp -SetEpochTimestamp()) /1000000e0); #else - result = timestamp - SetEpochTimestamp(); + result = timestamp -SetEpochTimestamp(); #endif break; case DTK_DOW: - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3563,7 +3589,7 @@ timestamptz_part(PG_FUNCTION_ARGS) break; case DTK_DOY: - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3738,7 +3764,7 @@ Datum timestamp_zone(PG_FUNCTION_ARGS) { text *zone = PG_GETARG_TEXT_P(0); - Timestamp timestamp = PG_GETARG_TIMESTAMP(1); + Timestamp timestamp = PG_GETARG_TIMESTAMP(1); TimestampTz result; int tz; int type, @@ -3780,7 +3806,7 @@ Datum timestamp_izone(PG_FUNCTION_ARGS) { Interval *zone = PG_GETARG_INTERVAL_P(0); - Timestamp timestamp = PG_GETARG_TIMESTAMP(1); + Timestamp timestamp = PG_GETARG_TIMESTAMP(1); TimestampTz result; int tz; @@ -3811,7 +3837,7 @@ timestamp_izone(PG_FUNCTION_ARGS) Datum timestamp_timestamptz(PG_FUNCTION_ARGS) { - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); + Timestamp timestamp = PG_GETARG_TIMESTAMP(0); PG_RETURN_TIMESTAMPTZ(timestamp2timestamptz(timestamp)); } @@ -3827,9 +3853,10 @@ timestamp2timestamptz(Timestamp timestamp) if (TIMESTAMP_NOT_FINITE(timestamp)) result = timestamp; + else { - if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0) + if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); @@ -3861,9 +3888,10 @@ timestamptz_timestamp(PG_FUNCTION_ARGS) if (TIMESTAMP_NOT_FINITE(timestamp)) result = timestamp; + else { - if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0) + if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) !=0) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range"))); diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index e50427d2e3..de88e86bbc 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -8,7 +8,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -79,7 +79,7 @@ static void fmgr_info_C_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedur static void fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple); static CFuncHashTabEntry *lookup_C_func(HeapTuple procedureTuple); static void record_C_func(HeapTuple procedureTuple, - PGFunction user_fn, Pg_finfo_record *inforec); + PGFunction user_fn, Pg_finfo_record *inforec); static Datum fmgr_oldstyle(PG_FUNCTION_ARGS); static Datum fmgr_security_definer(PG_FUNCTION_ARGS); @@ -244,8 +244,8 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, if (fbp == NULL) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("internal function \"%s\" is not in internal lookup table", - prosrc))); + errmsg("internal function \"%s\" is not in internal lookup table", + prosrc))); pfree(prosrc); /* Should we check that nargs, strict, retset match the table? */ finfo->fn_addr = fbp->func; @@ -300,7 +300,10 @@ fmgr_info_C_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple) *probinstring; 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, Anum_pg_proc_prosrc, &isnull); if (isnull) @@ -470,7 +473,7 @@ fetch_finfo_record(void *filehandle, char *funcname) static CFuncHashTabEntry * lookup_C_func(HeapTuple procedureTuple) { - Oid fn_oid = HeapTupleGetOid(procedureTuple); + Oid fn_oid = HeapTupleGetOid(procedureTuple); CFuncHashTabEntry *entry; if (CFuncHash == NULL) @@ -495,9 +498,9 @@ static void record_C_func(HeapTuple procedureTuple, PGFunction user_fn, Pg_finfo_record *inforec) { - Oid fn_oid = HeapTupleGetOid(procedureTuple); + Oid fn_oid = HeapTupleGetOid(procedureTuple); CFuncHashTabEntry *entry; - bool found; + bool found; /* Create the hash table if it doesn't exist yet */ if (CFuncHash == NULL) @@ -758,8 +761,8 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) */ ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg("function %u has too many arguments (%d, maximum is %d)", - fcinfo->flinfo->fn_oid, n_arguments, 16))); + errmsg("function %u has too many arguments (%d, maximum is %d)", + fcinfo->flinfo->fn_oid, n_arguments, 16))); returnValue = NULL; /* keep compiler quiet */ break; } @@ -1622,8 +1625,8 @@ fmgr(Oid procedureId,...) if (n_arguments > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg("function %u has too many arguments (%d, maximum is %d)", - flinfo.fn_oid, n_arguments, FUNC_MAX_ARGS))); + errmsg("function %u has too many arguments (%d, maximum is %d)", + flinfo.fn_oid, n_arguments, FUNC_MAX_ARGS))); va_start(pvar, procedureId); for (i = 0; i < n_arguments; i++) fcinfo.arg[i] = (Datum) va_arg(pvar, char *); diff --git a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c index 0dcf3e8a8c..4bdbfe9563 100644 --- a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c +++ b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c @@ -7,7 +7,7 @@ * * 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 */ @@ -19,7 +19,7 @@ typedef struct { unsigned short code, peer; -} codes_t; +} codes_t; /* map Big5 Level 1 to CNS 11643-1992 Plane 1 */ static codes_t big5Level1ToCnsPlane1[25] = { /* range */ @@ -205,7 +205,7 @@ static unsigned short b2c3[][2] = { }; static unsigned short BinarySearchRange - (codes_t * array, int high, unsigned short code) + (codes_t *array, int high, unsigned short code) { int low, mid, diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c index a5af5426c1..24594355e2 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * 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 $ * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ typedef struct pg_utf_to_local *map2; /* from UTF-8 map name */ int size1; /* size of map1 */ int size2; /* size of map2 */ -} pg_conv_map; +} pg_conv_map; static pg_conv_map maps[] = { {PG_SQL_ASCII}, /* SQL/ASCII */ diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index c7191baf4a..252d4a7f9e 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * 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 $ * *-------------------------------------------------------------------- */ @@ -3861,13 +3861,13 @@ flatten_set_variable_args(const char *name, List *args) * Coerce to interval and back to normalize the value * and account for any typmod. */ - Datum interval; + Datum interval; char *intervalout; interval = - DirectFunctionCall3(interval_in, - CStringGetDatum(val), - ObjectIdGetDatum(InvalidOid), + DirectFunctionCall3(interval_in, + CStringGetDatum(val), + ObjectIdGetDatum(InvalidOid), Int32GetDatum(arg->typename->typmod)); intervalout = diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index 181b9df11d..4075e2c45e 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -14,7 +14,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -157,7 +157,7 @@ ResourceOwnerRelease(ResourceOwner owner, save = CurrentResourceOwner; PG_TRY(); - ResourceOwnerReleaseInternal(owner, phase, isCommit, isTopLevel); + ResourceOwnerReleaseInternal(owner, phase, isCommit, isTopLevel); PG_CATCH(); { CurrentResourceOwner = save; |
