summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.c
AgeCommit message (Collapse)Author
2000-08-08Remove 'func_tlist' from Func expression nodes, likewise 'param_tlist'Tom Lane
from Param nodes, per discussion a few days ago on pghackers. Add new expression node type FieldSelect that implements the functionality where it's actually needed. Clean up some other unused fields in Func nodes as well. NOTE: initdb forced due to change in stored expression trees for rules.
2000-06-15Clean up #include's.Bruce Momjian
2000-06-05Latest round of fmgr updates. All functions with bool,char, or int2Tom Lane
inputs have been converted to newstyle. This should go a long way towards fixing our portability problems with platforms where char and short parameters are passed differently from int-width parameters. Still more to do for the Alpha port however.
2000-05-30Remove unused include files. Do not touch /port or includes used by defines.Bruce Momjian
2000-05-29Generated header files parse.h and fmgroids.h are now copied intoTom Lane
the src/include tree, so that -I backend is no longer necessary anywhere. Also, clean up some bit rot in contrib tree.
2000-05-25Modify raw parsetree representation returned by gram.y for SubLinks:Tom Lane
the oper field should be a valid Node structure so it can be dumped by outfuncs.c without risk of coredump. (We had been using a raw pointer to character string, which surely is NOT a valid Node.) This doesn't cause any backwards compatibility problems for stored rules, since raw unanalyzed parsetrees are never stored.
2000-04-12Ye-old pgindent run. Same 4-space tabs.Bruce Momjian
2000-03-19transformExpr() did the Wrong Thing if applied to a SubLink node thatTom Lane
had already been transformed. This led to failure in examples like UPDATE table SET fld = (SELECT ...). Repair this, and revise the comments to explain that transformExpr has to be robust against this condition. Someday we might want to fix the callers so that transformExpr is never invoked on its own output, but that someday is not today.
2000-03-17Add safety check on expression nesting depth. Default value is set byTom Lane
a config.h #define, and the runtime value can be controlled via SET.
2000-03-14Implement column aliases on views "CREATE VIEW name (collist)".Thomas G. Lockhart
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.
2000-03-07Someone (probably me) forgot about handling of typecasts applied toTom Lane
parameters.
2000-02-26Fix exprTypmod to recognize length-coercion function expressions,Tom Lane
such as bpchar(char_expression, N), and pull out the attrtypmod that the function is coercing to. This allows correct deduction of the column type in examples such as CREATE VIEW v AS SELECT f1::char(8) FROM tbl; Formerly we labeled v's column as char-of-unknown-length not char(8). Also, this change causes the parser not to insert a redundant length coercion function if the user has explicitly casted an INSERT or UPDATE expression to the right length.
2000-02-21Change parse-time representation of float literals (which include oversizeTom Lane
integers) to be strings instead of 'double'. We convert from string form to internal representation only after type resolution has determined the correct type for the constant. This eliminates loss-of-precision worries and gets rid of the change in behavior seen at 17 digits with the previous kluge.
2000-02-20Create a new expression node type RelabelType, which exists solely toTom Lane
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.
2000-02-15Carry column aliases from the parser frontend. Enables queries likeThomas G. Lockhart
SELECT a FROM t1 tx (a); Allow join syntax, including queries like SELECT * FROM t1 NATURAL JOIN t2; Update RTE structure to hold column aliases in an Attr structure.
2000-01-26Add:Bruce Momjian
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
2000-01-17Pass atttypmod to CoerceTargetExpr, so that it can pass it on toTom Lane
coerce_type, so that the right things happen when coercing a previously- unknown constant to a destination data type.
2000-01-17Create a new parsetree node type, TypeCast, so that transformation ofTom Lane
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.
2000-01-16Fix passing of atttypmod that Tom found.Bruce Momjian
1999-12-24Clean up handling of explicit NULL constants. Cases likeTom Lane
SELECT null::text; SELECT int4fac(null); work as expected now. In some cases a NULL must be surrounded by parentheses: SELECT 2 + null; fails SELECT 2 + (null); OK This is a grammatical ambiguity that seems difficult to avoid. Other than that, NULLs seem to behave about like you'd expect. The internal implementation is that NULL constants are typed as UNKNOWN (like untyped string constants) until the parser can deduce the right type.
1999-12-17Reverse out nextval patch.Bruce Momjian
1999-12-16>Turning nextval and currval into keywords is not an acceptable way toBruce Momjian
>go about this. That will risk breaking existing applications that use >those names as column names. > >It should actually almost work to write sq.nextval as things stand, >because Postgres has for a long time considered table.function and >function(table) to be interchangeable notations for certain kinds of >functions. nextval doesn't seem to be one of that kind of function, >at the moment. I'd suggest leaving the grammar as it was, and taking a >look at ParseFuncOrColumn in parse_func.c to see if you can't persuade >it to accept the sequence functions in that style. OK, good point. I tried to implement it somewhere else and ended up extending transformAttr. Attached you'll find the patch. Jeroen van Vianen
1999-12-10Teach grammar and parser about aggregate(DISTINCT ...). No implementationTom Lane
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'.
1999-11-15Implement subselects in target lists. Also, relax requirement thatTom Lane
subselects can only appear on the righthand side of a binary operator. That's still true for quantified predicates like x = ANY (SELECT ...), but a subselect that delivers a single result can now appear anywhere in an expression. This is implemented by changing EXPR_SUBLINK sublinks to represent just the (SELECT ...) expression, without any 'left hand side' or combining operator --- so they're now more like EXISTS_SUBLINK. To handle the case of '(x, y, z) = (SELECT ...)', I added a new sublink type MULTIEXPR_SUBLINK, which acts just like EXPR_SUBLINK used to. But the grammar will only generate one for a multiple-left-hand-side row expression.
1999-09-13Allow CASE statement to contain *only* untyped result clauses or nulls.Thomas G. Lockhart
Almost worked before, but forgot one place to check. Reported by Tatsuo Ishii. Still does not do the right thing if inserting into a non-string target column. Should look for a type coersion later, but doesn't.
1999-08-25Revise implementation of SubLinks so that there is a consistent,Tom Lane
documented intepretation of the lefthand and oper fields. Fix a number of obscure problems while at it --- for example, the old code failed if the parser decided to insert a type-coercion function just below the operator of a SubLink. CAUTION: this will break stored rules that contain subplans. You may need to initdb.
1999-08-05Revise parse_coerce() to handle coercion of int and floatTom Lane
constants, not only string constants, at parse time. Get rid of parser_typecast2(), which is bogus and redundant...
1999-07-19Rewrite parser's handling of INSERT ... SELECT so that processingTom Lane
of the SELECT part of the statement is just like a plain SELECT. All INSERT-specific processing happens after the SELECT parsing is done. This eliminates many problems, e.g. INSERT ... SELECT ... GROUP BY using the wrong column labels. Ensure that DEFAULT clauses are coerced to the target column type, whether or not stored clause produces the right type. Substantial cleanup of parser's array support.
1999-07-17 Move some system includes into c.h, and remove duplicates.Bruce Momjian
1999-07-16Support subscripts on bare column names.Tom Lane
1999-07-16Final cleanup.Bruce Momjian
1999-07-15Remove unused #includes in *.c files.Bruce Momjian
1999-07-11Ignore resjunk targetlist entries when matching arguments toTom Lane
a SubLink with the subplan's targetlist. This fixes a problem seen with, for example, a subselect that uses GROUP BY.
1999-05-26Make functions static or NOT_USED as appropriate.Bruce Momjian
1999-05-25pgindent run over code.Bruce Momjian
1999-05-22Fix for DEFAULT ''.Bruce Momjian
1999-05-18Add Aggref and ArrayRef to the set of node types that transformExprTom Lane
will pass through rather than spitting up. This is necessary to handle cases where coerce_type causes a subexpression to be retransformed, as in SELECT count(*) + 1.0 FROM table
1999-05-13Rip out QueryTreeList structure, root and branch. QuerytreeTom Lane
lists are now plain old garden-variety Lists, allocated with palloc, rather than specialized expansible-array data allocated with malloc. This substantially simplifies their handling and eliminates several sources of memory leakage. Several basic types of erroneous queries (syntax error, attempt to insert a duplicate key into a unique index) now demonstrably leak zero bytes per query.
1999-05-12Handle conversion of floating point constants to internal strings.Thomas G. Lockhart
1999-04-23Add disk space message to "can not extend" message.Bruce Momjian
1999-04-19Fix problems seen when result of a subselect was used in anTom Lane
expression context (ie, not at the top level of a WHERE clause). Examples like this one work now: SELECT name, value FROM t1 as touter WHERE (value/(SELECT AVG(value) FROM t1 WHERE name = touter.name)) > 0.75;
1999-04-18After transforming a CASE expr with a default argument,Tom Lane
delete the default argument from the node. This prevents the executor from spitting up on the untransformed argument expression. Typical failure was: select (case f1 when 'val' then 'subst' else f1 end) from t1; ERROR: copyObject: don't know how to copy 704
1999-02-03Cleanup of source files where 'return' or 'var =' is alone on a line.Bruce Momjian
1999-01-24Rename Aggreg to Aggref.Bruce Momjian
1998-12-13Improve CASE statement support.Thomas G. Lockhart
Try to label CASE columns for a SELECT if not specified with an AS clause.
1998-12-04Implement CASE expression.Thomas G. Lockhart
1998-10-02 the following little patch adds array references to queryBruce Momjian
parameters. With it applied a function like CREATE FUNCTION getname(oid8, int4) RETURNS name AS 'SELECT typname FROM pg_type WHERE oid = $1[$2]' LANGUAGE 'sql'; is possible. Mainly I need this to enable array references in expressions for PL/pgSQL. Complete regression test ran O.K. Jan
1998-10-01Fix for constbyval.Bruce Momjian
1998-09-01OK, folks, here is the pgindent output.Bruce Momjian
1998-09-01Renaming cleanup, no pgindent yet.Bruce Momjian