summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
2005-12-10Teach deparsing of CASE expressions to cope with the simplified formsTom Lane
that simplify_boolean_equality() may leave behind. This is only relevant if the user writes something a bit silly, like CASE x=y WHEN TRUE THEN. Per example from Michael Fuhr; may or may not explain bug #2106.
2005-12-09Simplify lock manager data structures by making a clear separation betweenTom Lane
the data defining the semantics of a lock method (ie, conflict resolution table and ancillary data, which is all constant) and the hash tables storing the current state. The only thing we give up by this is the ability to use separate hashtables for different lock methods, but there is no need for that anyway. Put some extra fields into the LockMethod definition structs to clean up some other uglinesses, like hard-wired tests for DEFAULT_LOCKMETHOD and USER_LOCKMETHOD. This commit doesn't do anything about the performance issues we were discussing, but it clears away some of the underbrush that's in the way of fixing that.
2005-12-03Allow to_char(interval) and to_char(time) to use AM/PM specifications.Bruce Momjian
Map them to a single day, so '30 hours' is 'AM'. Have to_char(interval) and to_char(time) use "HH", "HH12" as 12-hour intervals, rather than bypass and print the full interval hours. This is neeeded because to_char(time) is mapped to interval in this function. Intervals should use "HH24", and document suggestion. Allow "D" format specifiers for interval/time.
2005-12-02Remove comment on errno=0 lines, but add mention to port/strtol.c function.Bruce Momjian
2005-12-01Add comment to pg_atoi.Bruce Momjian
2005-12-01Comment "errno = 0" in a more generic way.Bruce Momjian
2005-12-01Add comments about why errno is set to zero.Bruce Momjian
2005-12-01Check for overflow in strtol() while parsing datetime inputs.Tom Lane
Michael Fuhr.
2005-11-30Rearrange code in pg_atoi() to avoid assuming that isspace() cannotTom Lane
change errno. No reported bugs here, but why take a chance?
2005-11-25Teach planner and executor to handle ScalarArrayOpExpr as an indexableTom Lane
qualification when the underlying operator is indexable and useOr is true. That is, indexkey op ANY (ARRAY[...]) is effectively translated into an OR combination of one indexscan for each array element. This only works for bitmap index scans, of course, since regular indexscans no longer support OR'ing of scans. There are still some loose ends to clean up before changing 'x IN (list)' to translate as a ScalarArrayOpExpr; for instance predtest.c ought to be taught about it. But this gets the basic functionality in place.
2005-11-22Fix up comment munged by pg_indent. (Not pg_indent's fault; should haveTom Lane
protected comment with dashes the first time round.)
2005-11-22Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
2005-11-19Change array comparison rules to consider dimensionality information,Tom Lane
not only the array contents, before claiming two arrays are equal. Per recent discussion.
2005-11-19Change array_push and array_cat so that they retain the lower bound ofTom Lane
the array (for array_push) or higher-dimensional array (for array_cat) rather than decrementing it as before. This avoids generating lower bounds other than one for any array operation within the SQL spec. Per recent discussion. Interestingly, this seems to have been the original behavior, because while updating the docs I noticed that a large fraction of relevant examples were *wrong* for the old behavior and are now right. Is it worth correcting this in the back-branch docs?
2005-11-18Mop-up for nulls-in-arrays patch: fix some places that access arrayTom Lane
contents directly.
2005-11-17Make SQL arrays support null elements. This commit fixes the core arrayTom Lane
functionality, but I still need to make another pass looking at places that incidentally use arrays (such as ACL manipulation) to make sure they are null-safe. Contrib needs work too. I have not changed the behaviors that are still under discussion about array comparison and what to do with lower bounds.
2005-11-07R-tree is dead ... long live GiST.Tom Lane
2005-11-04Remove a gratuitous string difference (does not affect translations).Peter Eisentraut
2005-11-04Disregard superuserness when checking to see if a role GRANT wouldTom Lane
create circularity of role memberships. This is a minimum-impact fix for the problem reported by Florian Pflug. I thought about removing the superuser_arg test from is_member_of_role() altogether, as it seems redundant for many of the callers --- but not all, and it's way too late in the 8.1 cycle to be making large changes. Perhaps reconsider this later.
2005-10-29Update a couple of obsolete comments.Tom Lane
2005-10-29Message correctionsPeter Eisentraut
2005-10-27Add comment documenting actual failure case of usingBruce Momjian
interval_justify_hours in timestamp subtraction. TODO already has text description.
2005-10-25Remove justify_hours call from interval_mul and interval_div, and makeTom Lane
some small stylistic improvements in these functions. Also fix several places where TMODULO() was being used with wrong-sized quotient argument, creating a risk of overflow --- interval2tm was actually capable of going into an infinite loop because of this.
2005-10-22minor code cleanup - replace useless struct timezone argument toAndrew Dunstan
gettimeofday with NULL in a few places, making it consistent with usage elsewhere.
2005-10-20Adjust not-too-sane calculation of DDD value for to_char(interval).Tom Lane
Per gripe from Chris Matheson.
2005-10-18Code review for regexp_replace patch. Improve documentation and comments,Tom Lane
fix problems with replacement-string backslashes that aren't followed by one of the expected characters, avoid giving the impression that replace_text_regexp() is meant to be called directly as a SQL function, etc.
2005-10-17Clean up libpq's pollution of application namespace by renaming theTom Lane
exported routines of ip.c, md5.c, and fe-auth.c to begin with 'pg_'. Also get rid of the vestigial fe_setauthsvc/fe_getauthsvc routines altogether.
2005-10-15Fix thinko in pg_read_file: testing for negative result is not the wayTom Lane
to determine whether fread() failed.
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-10-14Allow times of 24:00:00 to match rounding behavior:Bruce Momjian
regression=# select '23:59:59.9'::time(0); time ---------- 24:00:00 (1 row) This is bad because: regression=# select '24:00:00'::time(0); ERROR: date/time field value out of range: "24:00:00" The last example now works.
2005-10-11Document that get_attstatsslot/free_attstatsslot only need to be passedTom Lane
valid type information if they are asked to fetch the values part of a pg_statistic slot; these arguments are unneeded if fetching only the numbers part. Use this to save a catcache lookup in btcostestimate, which is looking like a bit of a hotspot in recent profiling. Not a big savings, but since it's essentially free, might as well do it.
2005-10-10Fix the problem of GRANTs creating "dangling" privileges not directlyTom Lane
traceable to grant options. As per my earlier proposal, a GRANT made by a role member has to be recorded as being granted by the role that actually holds the grant option, and not the member.
2005-10-09Fix (hopefully for the last time) problems with datetime values displayingTom Lane
like '23:59:60' because of fractional-second roundoff problems. Trying to control this upstream of the actual display code was hopeless; the right way is to explicitly round fractional seconds in the display code and then refigure the results if the fraction rounds up to 1. Per bug #1927.
2005-10-07Marginal performance improvement in aclmask(): don't bother withTom Lane
testing ownership if the caller isn't interested in any GOPTION bits (which is the common case). It did not matter in 8.0 where the ownership test was just a trivial equality test, but it matters now.
2005-10-06When a function not returning RECORD has a single OUT parameter, useTom Lane
the parameter's name (if any) as the default column name for SELECT FROM the function, rather than the function name as previously. I still think this is a bad idea, but I lost the argument. Force decompilation of function RTEs to specify full aliases always, to reduce the odds of this decision breaking dumped views.
2005-10-02Change nextval and other sequence functions to specify their sequenceTom Lane
argument as a 'regclass' value instead of a text string. The frontend conversion of text string to pg_class OID is now encapsulated as an implicitly-invocable coercion from text to regclass. This provides backwards compatibility to the old behavior when the sequence argument is explicitly typed as 'text'. When the argument is just an unadorned literal string, it will be taken as 'regclass', which means that the stored representation will be an OID. This solves longstanding problems with renaming sequences that are referenced in default expressions, as well as new-in-8.1 problems with renaming such sequences' schemas or moving them to another schema. All per recent discussion. Along the way, fix some rather serious problems in dbmirror's support for mirroring sequence operations (int4 vs int8 confusion for instance).
2005-09-29Fix confusion between relfilenode and Oid.Alvaro Herrera
Also, make pg_total_relation_size include the size of the TOAST index.
2005-09-24Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.Tom Lane
2005-09-24Suppress signed-vs-unsigned-char warnings.Tom Lane
2005-09-16Rename pg_complete_relation_size() to pg_total_relation_size(), for theNeil Conway
sake of brevity and clarity. Make pg_reload_conf(), pg_rotate_logfile(), and pg_cancel_backend() return a boolean rather than an integer to indicate success or failure. Along the way, make some minor cleanups to dbsize.c -- in particular, use elog() rather than ereport() for "shouldn't happen" error conditions, and remove some of the more flagrant violations of the Postgres indentation conventions. Catalog version bumped.
2005-09-16Update two comments to refer to use the new list API names.Neil Conway
2005-09-09timestamptz_izone should return the input, not NULL, when the inputTom Lane
is a non-finite timestamp, for consistency with related functions. In other words: +infinity rotated to a different timezone is still +infinity.
2005-09-09Fix the various forms of AT TIME ZONE to accept either timezones foundTom Lane
in the zic database or zone names found in the date token table. This preserves the old ability to do AT TIME ZONE 'PST' along with the new ability to do AT TIME ZONE 'PST8PDT'. Per gripe from Bricklen Anderson. Also, fix some inconsistencies in usage of TZ_STRLEN_MAX --- the old code had the potential for one-byte buffer overruns, though given alignment considerations it's unlikely there was any real risk.
2005-08-29Fix platform-specific test for path prefix-ness: move it into path.c whereTom Lane
it can be done right. Allow explicit use of absolute DataDir path. Per Dave Page.
2005-08-26The idea of using _strncoll() on Windows doesn't work. Revert to sameTom Lane
code as we use on other platforms when encoding is not UTF8.
2005-08-25Factor out the common subexpression month_remainder * DAYS_PER_MONTHTom Lane
in interval_mul and interval_div. This avoids an optimization bug in A Certain Company's compiler (and given their explanation, I wouldn't be surprised if other compilers blow it too). Besides the code seems more clear this way --- in the original formulation, you had to mentally recognize the common subexpression in order to understand what was going on.
2005-08-25Back out pfrees for justify_hour function calls.Bruce Momjian
2005-08-25Fix memory leak when using justify_hours.Bruce Momjian
2005-08-24Add small hack to support use of Unicode-based locales on WIN32. ThisTom Lane
is not adequately tested yet, but let's get it into beta1 so it can be tested. Magnus Hagander and Tom Lane.
2005-08-18Add hint for to_char(interval) invalid format specifications.Bruce Momjian