summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
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
2003-02-18Rename 'holder' references to 'proclock' for PROCLOCK references, forBruce Momjian
consistency.
2003-02-16COALESCE() and NULLIF() are now first-class expressions, not macrosTom Lane
that turn into CASE expressions. They evaluate their arguments at most once. Patch by Kris Jurka, review and (very light) editorializing by me.
2003-02-13Prevent timetz2tm() from scribbling on its input in HAVE_INT64_TIMESTAMP case.Tom Lane
2003-02-13The "random" regression test uses a function called oidrand(), whichBruce Momjian
takes two parameters, an OID x and an integer y, and returns "true" with probability 1/y (the OID argument is ignored). This can be useful -- for example, it can be used to select a random sampling of the rows in a table (which is what the "random" regression test uses it for). This patch removes that function, because it was old and messy. The old function had the following problems: - it was undocumented - it was poorly named - it was designed to workaround an optimizer bug that no longer exists (the OID argument is to ensure that the optimizer won't optimize away calls to the function; AFAIK marking the function as 'volatile' suffices nowadays) - it used a different random-number generation technique than the other PSRNG-related functions in the backend do (it called random() like they do, but it had its own logic for setting a set and deciding when to reseed the RNG). Ok, this patch removes oidrand(), oidsrand(), and userfntest(), and improves the SGML docs a little bit (un-commenting the setseed() documentation). Neil Conway
2003-02-13This patch makes pg_get_constraintdef support UNIQUE, PRIMARY KEY andBruce Momjian
CHECK constraints. There are apparently no other types of constraint in pg_constraint, so now all bases are covered. Also, this patch assumes that consrc for a CHECK constraint is always bracketed so that it's not necessary to add extra brackets. Christopher Kings-Lynne
2003-02-09Create a distinction between Lists of integers and Lists of OIDs, to getTom Lane
rid of the assumption that sizeof(Oid)==sizeof(int). This is one small step towards someday supporting 8-byte OIDs. For the moment, it doesn't do much except get rid of a lot of unsightly casts.
2003-02-08Replace planner's representation of relation sets, per pghackers discussion.Tom Lane
Instead of Lists of integers, we now store variable-length bitmap sets. This should be faster as well as less error-prone.
2003-02-06Create a GUC variable REGEX_FLAVOR to control the type of regularTom Lane
expression accepted by the regex operators, per discussion yesterday. Along the way, reduce deadlock_timeout from PGC_POSTMASTER to PGC_SIGHUP category. It is probably best to insist that all backends share the same setting, but that doesn't mean it has to be frozen at startup.
2003-02-05Replace regular expression package with Henry Spencer's latest versionTom Lane
(extracted from Tcl 8.4.1 release, as Henry still hasn't got round to making it a separate library). This solves a performance problem for multibyte, as well as upgrading our regexp support to match recent Tcl and nearly match recent Perl.
2003-02-03Determine the set of constraints applied to a domain at executorTom Lane
startup, not in the parser; this allows ALTER DOMAIN to work correctly with domain constraint operations stored in rules. Rod Taylor; code review by Tom Lane.
2003-02-03Don't print NO ACTION foreign key actions in dumps and psql \d.Bruce Momjian
2003-01-31Allow a time zone to be specified (and silently ignored) in the inputTom Lane
for type 'time without time zone', as we already did for type 'timestamp without time zone'. This patch was proposed by Tom Lockhart on 7-Nov-02, but he never got around to applying it. Adjust regression tests and documentation to match.
2003-01-29Tweak ArrayCount() to forestall possible access to temp[-1]. ProblemTom Lane
cannot actually happen at present because ArrayCount() is only called on strings beginning with '{', but seems best to prevent it going forward. Per report from Yichen Xie.
2003-01-29Repair array subscript overrun identified by Yichen Xie. Reduce theTom Lane
value of MAX_TIME_PRECISION in floating-point-timestamp-storage case from 13 to 10, which is as much as time_out is actually willing to print. (The alternative of increasing the number of digits we are willing to print looks risky; we might find ourselves printing roundoff garbage.)
2003-01-28Extend join-selectivity API (oprjoin interface) so that join type isTom Lane
passed to join selectivity estimators. Make use of this in eqjoinsel to derive non-bogus selectivity for IN clauses. Further tweaking of cost estimation for IN. initdb forced because of pg_proc.h changes.
2003-01-27Upgrade cost estimation for joins, per discussion with Bradley Baetz.Tom Lane
Try to model the effect of rescanning input tuples in mergejoins; account for JOIN_IN short-circuiting where appropriate. Also, recognize that mergejoin and hashjoin clauses may now be more than single operator calls, so we have to charge appropriate execution costs.
2003-01-24Suppress gcc warnings.Tom Lane
2003-01-24Modify planner's implied-equality-deduction code so that when a setTom Lane
of known-equal expressions includes any constant expressions (including Params from outer queries), we actively suppress any 'var = var' clauses that are or could be deduced from the set, generating only the deducible 'var = const' clauses instead. The idea here is to push down the restrictions implied by the equality set to base relations whenever possible. Once we have applied the 'var = const' clauses, the 'var = var' clauses are redundant, and should be suppressed both to save work at execution and to avoid double-counting restrictivity.
2003-01-23Grant options, and cascading revoke. Grant options are allowed only forPeter Eisentraut
users right now, not groups. Extension of has_foo_privileges functions to query the grant options. Extension of aclitem type to store grantor.
2003-01-22Fix sloppy comment.Tom Lane
2003-01-22Make estimation of mergejoin scan selectivities more robust, per recentTom Lane
example from RaÇl GutiÅrrez.
2003-01-21Avoid gratuitous variation in spelling of same error message.Tom Lane
2003-01-20IN clauses appearing at top level of WHERE can now be handled as joins.Tom Lane
There are two implementation techniques: the executor understands a new JOIN_IN jointype, which emits at most one matching row per left-hand row, or the result of the IN's sub-select can be fed through a DISTINCT filter and then joined as an ordinary relation. Along the way, some minor code cleanup in the optimizer; notably, break out most of the jointree-rearrangement preprocessing in planner.c and put it in a new file prep/prepjointree.c.