summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_coerce.c
Commit message (Collapse)AuthorAgeFilesLines
* Function-call-style type coercions should be treated as explicitTom Lane2002-10-241-5/+2
| | | | | | coercions, not implicit ones. For example, 'select abstime(1035497293)' should succeed because there is an explicit binary coercion from int4 to abstime.
* Extend pg_cast castimplicit column to a three-way value; this allows usTom Lane2002-09-181-107/+306
| | | | | | | | | | | | | | | | | | | | | | | | to be flexible about assignment casts without introducing ambiguity in operator/function resolution. Introduce a well-defined promotion hierarchy for numeric datatypes (int2->int4->int8->numeric->float4->float8). Change make_const to initially label numeric literals as int4, int8, or numeric (never float8 anymore). Explicitly mark Func and RelabelType nodes to indicate whether they came from a function call, explicit cast, or implicit cast; use this to do reverse-listing more accurately and without so many heuristics. Explicit casts to char, varchar, bit, varbit will truncate or pad without raising an error (the pre-7.2 behavior), while assigning to a column without any explicit cast will still raise an error for wrong-length data like 7.3. This more nearly follows the SQL spec than 7.2 behavior (we should be reporting a 'completion condition' in the explicit-cast cases, but we have no mechanism for that, so just do silent truncation). Fix some problems with enforcement of typmod for array elements; it didn't work at all in 'UPDATE ... SET array[n] = foo', for example. Provide a generalized array_length_coerce() function to replace the specialized per-array-type functions that used to be needed (and were missing for NUMERIC as well as all the datetime types). Add missing conversions int8<->float4, text<->numeric, oid<->int8. initdb forced.
* pgindent run.Bruce Momjian2002-09-041-46/+55
|
* Code cleanups: make non-implicit WITHOUT FUNCTION casts work, avoidTom Lane2002-09-011-299/+266
| | | | redundant pg_cast searches, fix obsolete comments.
* Code review for domain-constraints patch. Use a new ConstraintTest nodeTom Lane2002-08-311-52/+79
| | | | | | | | | type for runtime constraint checks, instead of misusing the parse-time Constraint node for the purpose. Fix some damage introduced into type coercion logic; in particular ensure that a coerced expression tree will read out the correct result type when inspected (patch had broken some RelabelType cases). Enforce domain NOT NULL constraints against columns that are omitted from an INSERT.
* Add a bunch of pseudo-types to replace the behavior formerly associatedTom Lane2002-08-221-19/+42
| | | | | | with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
* Manually apply part of oid patch that didn't apply cleanly.Bruce Momjian2002-07-201-2/+2
|
* pg_cast table, and standards-compliant CREATE/DROP CAST commands, plusPeter Eisentraut2002-07-181-40/+56
| | | | | | | | | | | extension to create binary compatible casts. Includes dependency tracking as well. pg_proc.proimplicit is now defunct, but will be removed in a separate commit. pg_dump provides a migration path from the previous scheme to declare casts. Dumping binary compatible casts is currently impossible, though.
* Oops, proper initialization for domainTypMod was none at all, not 0.Bruce Momjian2002-07-091-2/+2
|
* Fix compiler warning:Bruce Momjian2002-07-091-2/+2
| | | | | | | | int32 domainTypMod = NULL; should be: int32 domainTypMod = 0;
* I've fixed up the way domain constraints (not null and type length)Bruce Momjian2002-07-061-16/+93
| | | | | | | | | | | are managed as per request. Moved from merging with table attributes to applying themselves during coerce_type() and coerce_type_typmod. Regression tests altered to test the cast() scenarios. Rod Taylor
* Update copyright to 2002.Bruce Momjian2002-06-201-2/+2
|
* Get rid of the last few uses of typeidTypeName() rather thanTom Lane2002-05-171-6/+6
| | | | format_type_be() in error messages.
* Get rid of long-since-vestigial Iter node type, in favor of adding aTom Lane2002-05-121-17/+29
| | | | | | | returns-set boolean field in Func and Oper nodes. This allows cleaner, more reliable tests for expressions returning sets in the planner and parser. For example, a WHERE clause returning a set is now detected and complained of in the parser, not only at runtime.
* Implement types regprocedure, regoper, regoperator, regclass, regtypeTom Lane2002-04-251-33/+69
| | | | | | | per pghackers discussion. Add some more typsanity tests, and clean up some problems exposed thereby (broken or missing array types for some built-in types). Also, clean up loose ends from unknownin/out patch.
* Restructure representation of aggregate functions so that they have pg_procTom Lane2002-04-111-29/+45
| | | | | | | | | | entries, per pghackers discussion. This fixes aggregates to live in namespaces, and also simplifies/speeds up lookup in parse_func.c. Also, add a 'proimplicit' flag to pg_proc that controls whether a type coercion function may be invoked implicitly, or only explicitly. The current settings of these flags are more permissive than I would like, but we will need to debate and refine the behavior; for now, I avoided breaking regression tests as much as I could.
* Functions live in namespaces. Qualified function names work, egTom Lane2002-04-091-8/+19
| | | | | SELECT schema1.func2(...). Aggregate names can be qualified at the syntactic level, but the qualification is ignored for the moment.
* Code review for DOMAIN patch.Tom Lane2002-03-201-91/+187
|
* Add DOMAIN support. Includes manual pages and regression tests, fromBruce Momjian2002-03-191-1/+30
| | | | Rod Taylor.
* Back out domain patch until it works properly.Bruce Momjian2002-03-071-31/+1
|
* Ok. Updated patch attached.Bruce Momjian2002-03-061-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - domain.patch -> source patch against pgsql in cvs - drop_domain.sgml and create_domain.sgml -> New doc/src/sgml/ref docs - dominfo.txt -> basic domain related queries I used for testing [ ADDED TO /doc] Enables domains of array elements -> CREATE DOMAIN dom int4[3][2]; Uses a typbasetype column to describe the origin of the domain. Copies data to attnotnull rather than processing in execMain(). Some documentation differences from earlier. If this is approved, I'll start working on pg_dump, and a \dD <domain> option in psql, and regression tests. I don't really feel like doing those until the system table structure settles for pg_type. CHECKS when added, will also be copied to to the table attributes. FK Constraints (if I ever figure out how) will be done similarly. Both will lbe handled by MergeDomainAttributes() which is called shortly before MergeAttributes(). Rod Taylor
* pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian2001-10-251-9/+4
| | | | tests pass.
* Make the world safe for atttypmod=0 ... this didn't use to mean anything,Tom Lane2001-10-041-4/+3
| | | | but timestamp now wants it to mean something.
* Implement precision support for timestamp and time, both with and withoutThomas G. Lockhart2001-10-031-213/+14
| | | | | | | | | | | | time zones. SQL99 spec requires a default of zero (round to seconds) which is set in gram.y as typmod is set in the parse tree. We *could* change to a default of either 6 (for internal compatibility with previous versions) or 2 (for external compatibility with previous versions). Evaluate entries in pg_proc wrt the iscachable attribute for timestamp and other date/time types. Try to recognize cases where side effects like the current time zone setting may have an effect on results to decide whether something is cachable or not.
* Measure the current transaction time to milliseconds.Thomas G. Lockhart2001-09-281-5/+13
| | | | | | | | | | | | | | Define a new function, GetCurrentTransactionStartTimeUsec() to get the time to this precision. Allow now() and timestamp 'now' to use this higher precision result so we now have fractional seconds in this "constant". Add timestamp without time zone type. Move previous timestamp type to timestamp with time zone. Accept another ISO variant for date/time values: yyyy-mm-ddThh:mm:ss (note the "T" separating the day from hours information). Remove 'current' from date/time types; convert to 'now' in input. Separate time and timetz regression tests. Separate timestamp and timestamptz regression test.
* Back out BYTEA binary compatibility changes.Bruce Momjian2001-06-241-5/+1
|
* > Marko Kreen <marko@l-t.ee> writes:Bruce Momjian2001-06-231-1/+5
| | | | | | | | | | | | | > > secure_ctx changes too. it will be PGC_BACKEND after '-p'. > > Oh, okay, I missed that part. Could we see the total state of the > patch --- ie, a diff against current CVS, not a bunch of deltas? > I've gotten confused about what's in and what's out. Ok, here it is. Cleared the ctx comment too - after -p it will be PGC_BACKEND in any case. Marko Kreen
* Add IS UNKNOWN, IS NOT UNKNOWN boolean tests, fix the existing booleanTom Lane2001-06-191-1/+25
| | | | | | | tests to return the correct results per SQL9x when given NULL inputs. Reimplement these tests as well as IS [NOT] NULL to have their own expression node types, instead of depending on special functions. From Joe Conway, with a little help from Tom Lane.
* Make bit and bit varying types reject too long input. (They already triedPeter Eisentraut2001-05-221-2/+2
| | | | | | to do that, but inconsistently.) Make bit type reject too short input, too, per SQL. Since it no longer zero pads, 'zpbit*' has been renamed to 'bit*' in the source, hence initdb.
* pgindent run. Make it all clean.Bruce Momjian2001-03-221-25/+23
|
* Fix vacuum analyze error.Tatsuo Ishii2001-02-271-1/+7
| | | | | | | | | | | | | | | | | | vacuum analyze on pg_type fails if bogus entries remain in pg_operator. Here is a sample script to reproduce the problem. drop table t1; create table t1(i int); drop function foo(t1,t1); create function foo(t1,t1) returns bool as 'select true' language 'sql'; create operator = ( leftarg = t1, rightarg = t1, commutator = =, procedure = foo ); drop table t1; vacuum analyze;
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-241-2/+2
|
* Change lcons(x, NIL) to makeList(x) where appropriate.Bruce Momjian2001-01-171-3/+3
|
* Tweak select_common_type() to deal with possibility of multiple preferredTom Lane2000-12-171-1/+2
| | | | | types in a category --- it was taking the last preferred type among the inputs, rather than the first one as intended.
* Remove obsolete comment.Tom Lane2000-12-151-10/+1
|
* Add separate type category for bit string types, allowing mixed bit/varbitPeter Eisentraut2000-11-171-2/+6
| | | | function calls to work.
* Change SearchSysCache coding conventions so that a reference count isTom Lane2000-11-161-17/+19
| | | | | | | maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info.
* Arrange for CASE or UNION with only untyped literal constants as inputTom Lane2000-11-091-1/+17
| | | | to resolve the unknown constants as type TEXT.
* Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet theTom Lane2000-10-051-1/+95
| | | | | | | | | | | SQL92 semantics, including support for ALL option. All three can be used in subqueries and views. DISTINCT and ORDER BY work now in views, too. This rewrite fixes many problems with cross-datatype UNIONs and INSERT/SELECT where the SELECT yields different datatypes than the INSERT needs. I did that by making UNION subqueries and SELECT in INSERT be treated like subselects-in-FROM, thereby allowing an extra level of targetlist where the datatype conversions can be inserted safely. INITDB NEEDED!
* Type lztext is toast.Tom Lane2000-07-301-2/+1
| | | | | | | (Sorry, couldn't help it...) Removed type filename as well, since it's unused and probably useless. INITDB FORCED, because pg_rewrite columns are now plain text again.
* Update textin() and textout() to new fmgr style. This is just phaseTom Lane2000-07-051-2/+3
| | | | | one of updating the whole text datatype, but there are so dang many calls of these two routines that it seems worth a separate commit.
* Clean up #include's.Bruce Momjian2000-06-151-1/+2
|
* Remove unused include files. Do not touch /port or includes used by defines.Bruce Momjian2000-05-301-2/+1
|
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-121-44/+49
|
* Tweak TypeCategory to treat new BIT types as of STRING category, ratherTom Lane2000-04-081-1/+14
| | | | | | | than not knowing what they are at all. Perhaps they should have their own type category? Hard to say. In the meantime, doing it this way allows SELECT 'unknown' || 'unknown' to continue being resolved as textcat, instead of spitting out an ambiguous-operator error.
* Hack parse_coerce so it won't try to constant-fold the dummy ConstTom Lane2000-03-231-5/+10
| | | | | nodes introduced by make_subplan(). It'd be better if we used a different node type for subplan result placeholders, but for now...
* Reverse out BYTEA type coersion.Bruce Momjian2000-03-201-3/+1
|
* Add compatiblity information for bytea.Bruce Momjian2000-03-201-2/+5
|
* In can_coerce_type, verify that a possible type-coercion functionTom Lane2000-03-191-5/+13
| | | | actually returns the type it is named for.
* Turns out that Mazurkiewicz's gripe about 'function inheritance' isTom Lane2000-03-161-45/+57
| | | | | | actually a type-coercion problem. If you have a function defined on class A, and class B inherits from A, then the function ought to work on class B as well --- but coerce_type didn't know that. Now it does.