summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_coerce.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Implement column aliases on views "CREATE VIEW name (collist)".Thomas G. Lockhart2000-03-141-1/+2
| | | | | | | | | | | | | | | | | | Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
* Make TypeCategory think that NAME is a member of typeTom Lane2000-03-111-4/+10
| | | | | category STRING. Also, if UNKNOWNOID is passed in, return UNKNOWN_TYPE not USER_TYPE.
* Add lztext to TypeCategory so that lztext OP text cases will workTom Lane2000-02-271-1/+3
| | | | correctly (the lztext value will be promoted to text automatically).
* Create a new expression node type RelabelType, which exists solely toTom Lane2000-02-201-8/+24
| | | | | | | | | | represent the result of a binary-compatible type coercion. At runtime it just evaluates its argument --- but during type resolution, exprType will pick up the output type of the RelabelType node instead of the type of the argument. This solves some longstanding problems with dropped type coercions, an example being 'select now()::abstime::int4' which used to produce date-formatted output, not an integer, because the coercion to int4 was dropped on the floor.
* Even after the great date/time consolidation, TypeCategory() was stillTom Lane2000-02-201-1/+4
| | | | | | | | | a few bricks shy of a load concerning knowing all the date/time types. This is real bad because it interferes with func_select_candidate()'s willingness to disambiguate functions --- func_select_candidate() will punt unless all the available choices have the same type category. I think this whole mechanism needs redesigned, but in the meantime this is a needed patch.
* Implement "date/time grand unification".Thomas G. Lockhart2000-02-161-10/+15
| | | | | | | | | | | | | Transform datetime and timespan into timestamp and interval. Deprecate datetime and timespan, though translate to new types in gram.y. Transform all datetime and timespan catalog entries into new types. Make "INTERVAL" reserved word allowed as a column identifier in gram.y. Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility routines for all date/time types. date.{h,c} now deals with date, time types. timestamp.{h,c} now deals with timestamp, interval types. nabstime.{h,c} now deals with abstime, reltime, tinterval types. Make NUMERIC a known native type for purposes of type coersion. Not tested.
* Add:Bruce Momjian2000-01-261-2/+3
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
* Create a new parsetree node type, TypeCast, so that transformation ofTom Lane2000-01-171-3/+67
| | | | | | SQL cast constructs can be performed during expression transformation instead of during parsing. This allows constructs like x::numeric(9,2) and x::int2::float8 to behave as one would expect.
* Make number of args to a function configurable.Bruce Momjian2000-01-101-3/+3
|
* Teach grammar and parser about aggregate(DISTINCT ...). No implementationTom Lane1999-12-101-1/+3
| | | | | | | yet, but at least we can give a better error message: regression=> select count(distinct f1) from int4_tbl; ERROR: aggregate(DISTINCT ...) is not implemented yet instead of 'parser: parse error at or near distinct'.
* Add system indexes to match all caches.Bruce Momjian1999-11-221-2/+2
| | | | | | | Make all system indexes unique. Make all cache loads use system indexes. Rename *rel to *relid in inheritance tables. Rename cache names to be clearer.
* Teach parse_coerce about non-cachable functions (actually,Tom Lane1999-10-021-32/+17
| | | | make it call eval_const_expressions() so that it doesn't have to know).
* coerce_type() failed to guard against trying to convert a NULLTom Lane1999-08-241-17/+17
| | | | | constant to a different type. Not sure that this could happen in ordinary parser usage, but it can in some new code I'm working on...
* Revise parse_coerce() to handle coercion of int and floatTom Lane1999-08-051-56/+83
| | | | | constants, not only string constants, at parse time. Get rid of parser_typecast2(), which is bogus and redundant...
* Move some system includes into c.h, and remove duplicates.Bruce Momjian1999-07-171-2/+1
|
* Final cleanup.Bruce Momjian1999-07-161-4/+4
|
* Remove unused #includes in *.c files.Bruce Momjian1999-07-151-5/+1
|
* Defend against function calls with more than 8 arguments (codeTom Lane1999-06-171-3/+4
| | | | | used to overrun its fixed-size arrays before detecting error; not cool). Also, replace uses of magic constant '8' with 'MAXFARGS'.
* Avoid redundant SysCache searches in coerce_type, for anotherTom Lane1999-05-291-5/+7
| | | | few percent speedup in INSERT...
* pgindent run over code.Bruce Momjian1999-05-251-11/+13
|
* Fix for DEFAULT ''.Bruce Momjian1999-05-221-6/+12
|