summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
2007-02-19Add "isodow" option to EXTRACT() and date_part() where Sunday = 7.Bruce Momjian
2007-02-19Get rid of some old and crufty global variables in the planner. WhenTom Lane
this code was last gone over, there wasn't really any alternative to globals because we didn't have the PlannerInfo struct being passed all through the planner code. Now that we do, we can restructure things to avoid non-reentrancy. I'm fooling with this because otherwise I'd have had to add another global variable for the planned compact range table list.
2007-02-17Remove rint() for to_char MS and US output. We can't us rint() becauseBruce Momjian
we can't overflow to the next higher units, and we might print the lower units for MS.
2007-02-17Cleanup of to_char() patch.Bruce Momjian
Brendan Jurd
2007-02-17Create AVG() aggregates for int8 and NUMERIC which do not compute X^2,Bruce Momjian
as a performance enhancement. Mark Kirkwood
2007-02-16Better fix for determining minimum and maximum int64 values that doesn'tPeter Eisentraut
require stdint.h and works for "busted" int64.
2007-02-16Fix // commentPeter Eisentraut
2007-02-16Add stdint.h includePeter Eisentraut
2007-02-16Functions for mapping table data and table schemas to XML (a.k.a. XML export)Peter Eisentraut
2007-02-16Add two new format fields for use with to_char(), to_date() andBruce Momjian
to_timestamp(): - ID for day-of-week - IDDD for day-of-year This makes it possible to convert ISO week dates to and from text fully represented in either week ('IYYY-IW-ID') or day-of-year ('IYYY-IDDD') format. I have also added an 'isoyear' field for use with extract / date_part. Brendan Jurd
2007-02-14Fix to_date()/to_timestamp() 'D' field for day of week, was off by one.Bruce Momjian
Converting from char using 'D' doesn't make lots of sense, of course. Report from Brendan Jurd.
2007-02-14Fix up foreign-key mechanism so that there is a sound semantic basis for theTom Lane
equality checks it applies, instead of a random dependence on whatever operators might be named "=". The equality operators will now be selected from the opfamily of the unique index that the FK constraint depends on to enforce uniqueness of the referenced columns; therefore they are certain to be consistent with that index's notion of equality. Among other things this should fix the problem noted awhile back that pg_dump may fail for foreign-key constraints on user-defined types when the required operators aren't in the search path. This also means that the former warning condition about "foreign key constraint will require costly sequential scans" is gone: if the comparison condition isn't indexable then we'll reject the constraint entirely. All per past discussions. Along the way, make the RI triggers look into pg_constraint for their information, instead of using pg_trigger.tgargs; and get rid of the always error-prone fixed-size string buffers in ri_triggers.c in favor of building up the RI queries in StringInfo buffers. initdb forced due to columns added to pg_constraint and pg_trigger.
2007-02-13Un-break build on ANSI compilers (like msvc) by moving Assert to positionMagnus Hagander
after variable declarations.
2007-02-13Add comment that to_char() for broken glibc pt_BR might cause a problem.Bruce Momjian
2007-02-11Add support for optionally escaping periods when converting SQL identifiersPeter Eisentraut
to XML names, which will be required for supporting XML export.
2007-02-10Add proper mapping of boolean type data to XML Schema.Peter Eisentraut
2007-02-09Remove blank lines in code.Bruce Momjian
2007-02-09Remove blank line from C code.Bruce Momjian
2007-02-08Fix bug when localized to_char() day or month names were incorectlyBruce Momjian
trnasformed to lower or upper string. Pavel Stehule
2007-02-08Fix bug in our code when using to_timestamp() or to_date() without "TM".Bruce Momjian
Assume "TM" when input fields are variable-length, like month or day names. This matches Oracle behavior.
2007-02-07Add a function pg_stat_clear_snapshot() that discards any statistics snapshotTom Lane
already collected in the current transaction; this allows plpgsql functions to watch for stats updates even though they are confined to a single transaction. Use this instead of the previous kluge involving pg_stat_file() to wait for the stats collector to update in the stats regression test. Internally, decouple storage of stats snapshots from transaction boundaries; they'll now stick around until someone calls pgstat_clear_snapshot --- which xact.c still does at transaction end, to maintain the previous behavior. This makes the logic a lot cleaner, at the price of a couple dozen cycles per transaction exit.
2007-02-03Implement XMLSERIALIZE for real. Analogously, make the xml to text castPeter Eisentraut
observe the xmloption. Reorganize the representation of the XML option in the parse tree and the API to make it easier to manage and understand. Add regression tests for parsing back XML expressions.
2007-02-01Wording cleanup for error messages. Also change can't -> cannot.Bruce Momjian
Standard English uses "may", "can", and "might" in different ways: may - permission, "You may borrow my rake." can - ability, "I can lift that log." might - possibility, "It might rain today." Unfortunately, in conversational English, their use is often mixed, as in, "You may use this variable to do X", when in fact, "can" is a better choice. Similarly, "It may crash" is better stated, "It might crash".
2007-01-31Rewrite uuid input and output routines to avoid dependency on theNeil Conway
nonportable "hh" sprintf(3) length modifier. Instead, do the parsing and output by hand. The code to do this isn't ideal, but this is an interim measure anyway: the uuid type should probably use the in-memory struct layout specified by RFC 4122. For now, this patch should hopefully rectify the buildfarm failures for the uuid test. Along the way, re-add pg_cast entries for uuid <-> varchar, which I mistakenly removed earlier, and bump the catversion.
2007-01-31Revert gincostestimate changes.Teodor Sigaev
2007-01-31Allow GIN's extractQuery method to signal that nothing can satisfy the query.Teodor Sigaev
In this case extractQuery should returns -1 as nentries. This changes prototype of extractQuery method to use int32* instead of uint32* for nentries argument. Based on that gincostestimate may see two corner cases: nothing will be found or seqscan should be used. Per proposal at http://archives.postgresql.org/pgsql-hackers/2007-01/msg01581.php PS tsearch_core patch should be sightly modified to support changes, but I'm waiting a verdict about reviewing of tsearch_core patch.
2007-01-30Update documentation for pg_get_serial_sequence() function.Bruce Momjian
2007-01-28Rename the uuid_t type to pg_uuid_t, to avoid a conflict with anyNeil Conway
definitions of uuid_t that may be provided by the system headers. This should hopefully fix the Win32 build problems reported by Magnus.
2007-01-28Add a new builtin type, "uuid". This implements a UUID type, similar toNeil Conway
that defined in RFC 4122. This patch includes the basic implementation, plus regression tests. Documentation and perhaps some additional functionality will come later. Catversion bumped. Patch from Gevik Babakhani; review from Peter, Tom, and myself.
2007-01-28Dept of second thoughts: the IQ of estimate_array_length() needs to beTom Lane
kept on par with that of scalararraysel(), else estimates that should track might not. Hence teach it about binary-compatible cases, too.
2007-01-28Fix scalararraysel() to cope with binary-compatible cases, such as text[]Tom Lane
versus varchar[]. This oversight probably explains Ryan Holmes' recent complaint --- he was getting a generic selectivity estimate instead of anything intelligent.
2007-01-27Reactivate libxml memory management via palloc, now that I think I'vePeter Eisentraut
classified the conditions under which this is safe to do (see source code comment).
2007-01-27Add trailing zero byte in Unicode codepoint conversion.Peter Eisentraut
2007-01-25Various fixes in the logic of XML functions:Peter Eisentraut
- Add new SQL command SET XML OPTION (also available via regular GUC) to control the DOCUMENT vs. CONTENT option in implicit parsing and serialization operations. - Subtle corrections in the handling of the standalone property in xmlroot(). - Allow xmlroot() to work on content fragments. - Subtle corrections in the handling of the version property in xmlconcat(). - Code refactoring for producing XML declarations.
2007-01-25Properly detoast access to bytea field pg_trigger.tgargs. Old codeBruce Momjian
might cause server crash. Backpatch to 8.2.X.
2007-01-23Simplify handling of XML error messages: Just use the string provided byPeter Eisentraut
libxml as the detail message. As per <http://archives.postgresql.org/pgsql-hackers/2006-12/msg01087.php>. For converting error codes to messages, we only need to cover those codes that we raise ourselves now.
2007-01-22Put back planner's ability to cache the results of mergejoinscansel(),Tom Lane
which I had removed in the first cut of the EquivalenceClass rewrite to simplify that patch a little. But it's still important --- in a four-way join problem mergejoinscansel() was eating about 40% of the planning time according to gprof. Also, improve the EquivalenceClass code to re-use join RestrictInfos rather than generating fresh ones for each join considered. This saves some memory space but more importantly improves the effectiveness of caching planning info in RestrictInfos.
2007-01-20Simplify pg_am representation of ordering-capable access methods:Tom Lane
provide just a boolean 'amcanorder', instead of fields that specify the sort operator strategy numbers. We have decided to require ordering-capable AMs to use btree-compatible strategy numbers, so the old fields are overkill (and indeed misleading about what's allowed).
2007-01-20Make setseed() return void, rather than an int4 without any use. PerNeil Conway
pgsql-patches discussion of September 20, 2006. Bump the catversion.
2007-01-20Refactor planner's pathkeys data structure to create a separate, explicitTom Lane
representation of equivalence classes of variables. This is an extensive rewrite, but it brings a number of benefits: * planner no longer fails in the presence of "incomplete" operator families that don't offer operators for every possible combination of datatypes. * avoid generating and then discarding redundant equality clauses. * remove bogus assumption that derived equalities always use operators named "=". * mergejoins can work with a variety of sort orders (e.g., descending) now, instead of tying each mergejoinable operator to exactly one sort order. * better recognition of redundant sort columns. * can make use of equalities appearing underneath an outer join.
2007-01-20Remove remains of old depend target.Peter Eisentraut
2007-01-20Fix xmlconcat by properly merging the XML declarations. Add aggregatePeter Eisentraut
function xmlagg.
2007-01-20Add missing copyright blurb, make ruleutils.c use the standard layoutNeil Conway
for its header comment.
2007-01-19Add support for converting binary values (i.e. bytea) into xml values,Peter Eisentraut
with new GUC parameter "xmlbinary" that controls the output encoding, as per SQL/XML standard.
2007-01-18Clean up encoding issues in the xml type: In text mode, encodingPeter Eisentraut
declarations are ignored and removed, in binary mode they are honored as specified by the XML standard.
2007-01-16Implement width_bucket() for the float8 data type.Neil Conway
The implementation is somewhat ugly logic-wise, but I don't see an easy way to make it more concise. When writing this, I noticed that my previous implementation of width_bucket() doesn't handle NaN correctly: postgres=# select width_bucket('NaN', 1, 5, 5); width_bucket -------------- 6 (1 row) AFAICS SQL:2003 does not define a NaN value, so it doesn't address how width_bucket() should behave here. The patch changes width_bucket() so that ereport(ERROR) is raised if NaN is specified for the operand or the lower or upper bounds to width_bucket(). For float8, NaN is disallowed for any of the floating-point inputs, and +/- infinity is disallowed for the histogram bounds (but allowed for the operand). Update docs and regression tests, bump the catversion.
2007-01-14Fix reverse compilation of IS DOCUMENT expression.Peter Eisentraut
2007-01-14Add support for xmlval IS DOCUMENT expression.Peter Eisentraut
2007-01-12Fix handling of CC (century) format spec in to_date/to_char. According toTom Lane
standard convention the 21st century runs from 2001-2100, not 2000-2099, so make it work like that. Per bug #2885 from Akio Iwaasa. Backpatch to 8.2, but no further, since this is really a definitional change; users of older branches are probably more interested in stability.
2007-01-12Use XML output escaping also in XMLFOREST.Peter Eisentraut