summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
2003-05-23Improve implementation of btrim/ltrim/rtrim: provide a special case forTom Lane
single-byte encodings, and a direct C implementation of the single-argument forms (where spaces are always what gets trimmed). This is in preparation for using rtrim1() as the bpchar-to-text cast operator, but is a useful performance improvement even if we decide not to do that.
2003-05-20Fix coredump in pg_get_triggerdef, ensure function name is schema-Tom Lane
qualified when necessary, simplify argument-printing code.
2003-05-18Add code to test for unknown timezone names (following some ideas fromTom Lane
Ross Reedstrom, a couple months back) and to detect timezones that are using leap-second timekeeping. The unknown-zone-name test is pretty heuristic and ugly, but it seems better than the old behavior of just switching to GMT given a bad name. Also make DecodePosixTimezone() a tad more robust.
2003-05-15Indexing support for pattern matching operations via separate operatorPeter Eisentraut
class when lc_collate is not C.
2003-05-13More binary I/O routines.Tom Lane
2003-05-12Add binary I/O routines for a bunch more datatypes. Still a few to go,Tom Lane
but that was enough tedium for one day. Along the way, move the few support routines for types xid and cid into a more logical place.
2003-05-09Implement array_send/array_recv (binary I/O for arrays). This exposedTom Lane
the folly of not passing element type to typsend/typreceive, so fix that.
2003-05-09COPY BINARY uses the new binary I/O routines. Update a few more datatypesTom Lane
so that COPY BINARY regression test passes.
2003-05-09Remove another old rint() replacement.Bruce Momjian
2003-05-09Binary send/receive routines for a few basic datatypes --- enough forTom Lane
testing purposes.
2003-05-08Reinstate pg_type's typsend and typreceive columns. They don't do muchTom Lane
yet, but they're there. Also some editorial work on CREATE TYPE reference page.
2003-05-04Allow 60 in seconds fields of timestamp, time, interval input values.Tom Lane
Per recent discussion on pgsql-general, this is appropriate for spec compliance, and has the nice side-effect of easing porting from old pg_dump files that exhibit the 59.999=>60.000 roundoff problem.
2003-04-27Prevent coredump in current_schemas() if someone has just deleted aTom Lane
schema that was in our search path.
2003-04-26Repair permissions problem in RI triggers: query parsing has to be doneTom Lane
as the correct user, not only query execution. Per report from Sean Chittenden.
2003-04-24Infrastructure for upgraded error reporting mechanism. elog.c isTom Lane
rewritten and the protocol is changed, but most elog calls are still elog calls. Also, we need to contemplate mechanisms for controlling all this functionality --- eg, how much stuff should appear in the postmaster log? And what API should libpq expose for it?
2003-04-21stddev() and variance() should return NULL when there is just one inputTom Lane
value, per recent discussion on pgsql-general.
2003-04-16Fix stupid oversight ...Tom Lane
2003-04-15eqjoinsel's logic for case where MCV lists are not present shouldTom Lane
account for NULLs; in hindsight this is obvious since the code for the MCV-lists case would reduce to this when there are zero entries in both lists. Per example from Alec Mitchell.
2003-04-08First phase of work on array improvements. ARRAY[x,y,z] constructorTom Lane
expressions, ARRAY(sub-SELECT) expressions, some array functions. Polymorphic functions using ANYARRAY/ANYELEMENT argument and return types. Some regression tests in place, documentation is lacking. Joe Conway, with some kibitzing from Tom Lane.
2003-04-08Mark TimeScales constants as double to avoid integer overflow in some compilers.Tom Lane
2003-04-07Avoid primary key lookup (and lock) if foreign key does not changeJan Wieck
on UPDATE. This get's rid of the long standing annoyance that updating a row that has foreign keys locks all the referenced rows even if the foreign key values do not change. The trick is to actually do a check identical to NO ACTION after an eventually done UPDATE in the SET DEFAULT case. Since a SET DEFAULT operation should have moved referencing rows to a new "home", a following NO ACTION check can only fail if the column defaults of the referencing table resulted in the key we actually deleted. Thanks to Stephan. Jan
2003-04-07Remove unnecessary dt2local() call.Tom Lane
2003-04-04Avoid repeated computation of the constants date2j(1970, 1, 1) andTom Lane
date2j(2000, 1, 1). Should make for some marginal speed improvement in date/time operations.
2003-04-04Code review for pg_stat_get_backend_activity_start patch --- fixTom Lane
return type, make protection condition agree with recent change to pg_stat_get_backend_activity, clean up documentation.
2003-04-02Fix buffer overrun in to_ascii(), per report from Guido Notari.Tom Lane
2003-04-02Fix platform-dependent failure introduced by recent to_char changesTom Lane
(ye good olde uninitialized-local-variable).
2003-03-27Fix bogus coding of SET DEFAULT ri triggers ... or at least make it lessTom Lane
bogus than it was. Per bug report from Adrian Pop.
2003-03-27Fix syntax error in to_char fixes --- was defining variable in main codeBruce Momjian
block, ala C++.
2003-03-27to_char fixes, Karel ZakBruce Momjian
2003-03-23Instead of storing pg_statistic stavalues entries as text strings, storeTom Lane
them as arrays of the internal datatype. This requires treating the stavalues columns as 'anyarray' rather than 'text[]', which is not 100% kosher but seems to work fine for the purposes we need for pg_statistic. Perhaps in the future 'anyarray' will be allowed more generally.
2003-03-23Tweak selectivity and related routines to cope with domains. Per reportTom Lane
from Andreas Pflug.
2003-03-22Back out to_char fixes until regression tests are fixed.Bruce Momjian
2003-03-21Fix compile warning.Tom Lane
2003-03-21Add hostmask() function:Bruce Momjian
+ <entry><function>hostmask</function>(<type>inet</type>)</entry> + <entry><type>inet</type></entry> + <entry>construct hostmask for network</entry> + <entry><literal>hostmask('192.168.23.20/30')</literal></entry> + <entry><literal>0.0.0.3</literal></entry> Greg Wickham
2003-03-21Reimplement NUMERIC datatype using base-10000 arithmetic; also improveTom Lane
some of the algorithms for higher functions. I see about a factor of ten speedup on the 'numeric' regression test, but it's unlikely that that test is representative of real-world applications. initdb forced due to change of on-disk representation for NUMERIC.
2003-03-20This patch creates a function named pg_get_triggerdef that takes the oid ofBruce Momjian
a trigger as its parameter. It is basically copied from the pg_dump code. Christopher Kings-Lynne
2003-03-20It would also be handy if users could see their own pg_stat_activityBruce Momjian
queries while the rest remain blank. Kevin Brown
2003-03-20Attached is a patch that limits the range tested by horology toBruce Momjian
what is capable using integer-datatime timestamps. It does attempt to exercise the maximum allowable timestamp range. Also is a small error check when converting a timestamp from external to internal format that prevents out of range timestamps from being entered. Files patched: Index: src/backend/utils/adt/timestamp.c Added range check to prevent out of range timestamps from being used. Index: src/test/regress/sql/horology.sql Index: src/test/regress/expected/horology-no-DST-before-1970.out Index: src/test/regress/expected/horology-solaris-1947.out Limited range of timestamps being checked to Jan 1, 4713 BC to Dec 31, 294276 In creating this patch, I have seen some definite problems with integer timestamps and how they react when used near their limits. For example, the following statement gives the correct result: SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276"; However, this statement which is the logical inverse of the above gives incorrect results: SELECT timestamp without time zone '12/31/294276' - timestamp without time zone 'Jan 1, 4713 BC' AS "109203489 Days"; John Cochran
2003-03-20 Peter found bug in the to_char() routine for PL/MI options. ThisBruce Momjian
patch fix it -- but this patch doesn't contains tests or docs fixes. I will send it later. Fixed outputs: select to_char(x, '9999.999') as x, to_char(x, 'S9999.999') as s, to_char(x, 'SG9999.999') as sg, to_char(x, 'MI9999.999') as mi, to_char(x, 'PL9999.999') as pl, to_char(x, 'PLMI9999.999') as plmi, to_char(x, '9999.999SG') as sg2, to_char(x, '9999.999PL') as pl2, to_char(x, '9999.999MI') as mi2 from num; Karel Zak
2003-03-20Add start time to pg_stat_activityBruce Momjian
Neil Conway
2003-03-15Arrange to print the relevant key values when reporting a foreign-keyTom Lane
violation. Also, factor out some duplicate code in the RI triggers. Patch by Dmitry Tkach, reviewed by Stephan Szabo and Tom Lane.
2003-03-14Prevent infinite loop in ln_var() due to roundoff error.Tom Lane
Per report from Dave Marin.
2003-03-11Add explicit tests for division by zero to all user-accessible integerTom Lane
division and modulo functions, to avoid problems on OS X (which fails to trap 0 divide at all) and Windows (which traps it in some bizarre nonstandard fashion). Standardize on 'division by zero' as the one true spelling of this error message. Add regression tests as suggested by Neil Conway.
2003-03-10This patch fixes a bunch of spelling mistakes in comments throughout theTom Lane
PostgreSQL source code. Neil Conway
2003-02-27Change EXTRACT(EPOCH FROM timestamp) so that a timestamp without time zoneTom Lane
is assumed to be in local time, not GMT. This improves consistency with other operations, which all assume local timezone when it matters. Per bug #897.
2003-02-22Simplify timezone-handling code per proposal to pghackers: get rid ofTom Lane
setting timezone-related variables during transaction start. They were not used anyway in platforms that HAVE_TM_ZONE or HAVE_INT_TIMEZONE, which it appears is *all* the platforms we are currently supporting. For platforms that have neither, we now only support UTC or numeric- offset-from-UTC timezones.
2003-02-20Fix timestamptz_in so that parsing of 'now'::timestamptz gives rightTom Lane
answer when SET TIMEZONE has been done since the start of the current transaction. Per bug report from Robert Haas. I plan some futher cleanup in HEAD, but this is a low-risk patch for the immediate issue in 7.3.
2003-02-19Back out LOCKTAG changes by Rod Taylor, pending code review. Sorry.Bruce Momjian
2003-02-19- Modifies LOCKTAG to include a 'classId'. Relation receive a classId ofBruce Momjian
RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed to objId. - LockObject() and UnlockObject() functions created, and their use sprinkled throughout the code to do descent locking for domains and types. They accept lock modes AccessShare and AccessExclusive, as we only really need a 'read' and 'write' lock at the moment. Most locking cases are held until the end of the transaction. This fixes the cases Tom mentioned earlier in regards to locking with Domains. If the patch is good, I'll work on cleaning up issues with other database objects that have this problem (most of them). Rod Taylor
2003-02-19The following patches eliminate the overflows in the j2date() and date2j()Bruce Momjian
functions which limited the maximum date for a timestamp to AD 1465001. The new limit is AD 5874897. The files affected are: doc/src/sgml/datatype.sgml: Documentation change due to patch. Included is a notice about the reduced range when using an eight-byte integer for timestamps. src/backend/utils/adt/datetime.c: Replacement functions for j2date() and date2j() functions. src/include/utils/datetime.h: Corrected a bug with the limit on the earliest possible date, Nov 23,-4713 has a Julian day count of -1. The earliest possible date should be Nov 24, -4713 with a day count of 0. src/test/regress/expected/horology-no-DST-before-1970.out: src/test/regress/expected/horology-solaris-1947.out: src/test/regress/expected/horology.out: Copies of expected output for regression testing. Note: Only horology.out has been physically tested. I do not have access to a Solaris box and I don't know how to provoke the "pre-1970" test. src/test/regress/sql/horology.sql: Added some test cases to check extended range. John Cochran