aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
Commit message (Collapse)AuthorAge
...
* Change EXECUTE INTO to CREATE TABLE AS EXECUTE.Peter Eisentraut2003-07-01
|
* Support expressions of the form 'scalar op ANY (array)' andTom Lane2003-06-29
| | | | | | | | | | 'scalar op ALL (array)', where the operator is applied between the lefthand scalar and each element of the array. The operator must yield boolean; the result of the construct is the OR or AND of the per-element results, respectively. Original coding by Joe Conway, after an idea of Peter's. Rewritten by Tom to keep the implementation strictly separate from subqueries.
* Fix compile warnings.Tom Lane2003-06-27
|
* First batch of object rename commands.Peter Eisentraut2003-06-27
|
* Create real array comparison functions (that use the element datatype'sTom Lane2003-06-27
| | | | | | | | | | | | | | | | comparison functions), replacing the highly bogus bitwise array_eq. Create a btree index opclass for ANYARRAY --- it is now possible to create indexes on array columns. Arrange to cache the results of catalog lookups across multiple array operations, instead of repeating the lookups on every call. Add string_to_array and array_to_string functions. Remove singleton_array, array_accum, array_assign, and array_subscript functions, since these were for proof-of-concept and not intended to become supported functions. Minor adjustments to behavior in some corner cases with empty or zero-dimensional arrays. Joe Conway (with some editorializing by Tom Lane).
* Back out array mega-patch.Bruce Momjian2003-06-25
| | | | Joe Conway
* Don't generate 'zero' typeids in the output from gen_cross_product.Tom Lane2003-06-25
| | | | | | This is no longer necessary or appropriate since we don't use zero typeid as a wildcard anymore, and it fixes a nasty performance problem with functions with many parameters. Per recent example from Reuven Lerner.
* Fix up JOIN .. USING with domainsBruce Momjian2003-06-25
| | | | | | | | | | | | | | | | The attached fixes select_common_type() to support the below case: create table t1( c1 int); create domain dom_c1 int; create table t2(c1 dom_c1); select * from t1 join t2 using( c1 ); I didn't see a need for maintaining the domain as the preferred type. A simple getBaseType() call on all elements of the list seems to be enough. -- Rod Taylor <rbt@rbt.ca>
* UPDATE ... SET <col> = DEFAULTBruce Momjian2003-06-25
| | | | Rod Taylor
* Includes:Bruce Momjian2003-06-25
| | | | | | | | | | | | | | | | - LIKE <subtable> [ INCLUDING DEFAULTS | EXCLUDING DEFAULTS ] - Quick cleanup of analyze.c function prototypes. - New non-reserved keywords (INCLUDING, EXCLUDING, DEFAULTS), SQL 200X Opted not to extend for check constraints at this time. As per the definition that it's user defined columns, OIDs are NOT inherited. Doc and Source patches attached. -- Rod Taylor <rbt@rbt.ca>
* Array mega-patch.Bruce Momjian2003-06-24
| | | | Joe Conway
* Disallow dollar sign in operator names, instead allow it as a non-firstTom Lane2003-06-19
| | | | | | | character in identifiers. The first change eliminates the current need to put spaces around parameter references, as in "x<=$2". The second change improves compatibility with Oracle and some other RDBMSes. This was discussed and agreed to back in January, but did not get done.
* Make FLOAT(p) measure the precision p in bits, not decimal digits, toTom Lane2003-06-17
| | | | | match the SQL standard. Document FLOAT and FLOAT(p) notations in datatype.sgml. Per recent pghackers discussion.
* Allow GROUP BY, ORDER BY, DISTINCT targets to be unknown literals,Tom Lane2003-06-16
| | | | | | | | | silently resolving them to type TEXT. This is comparable to what we do when faced with UNKNOWN in CASE, UNION, and other contexts. It gets rid of this and related annoyances: select distinct f1, '' from int4_tbl; ERROR: Unable to identify an ordering operator '<' for type unknown This was discussed many moons ago, but no one got round to fixing it.
* Replace cryptic 'Unknown kind of return type' messages with somethingTom Lane2003-06-15
| | | | hopefully a little more useful.
* Cause GROUP BY clause to adopt ordering operators from ORDER BY whenTom Lane2003-06-15
| | | | | | both clauses specify the same targets, rather than always using the default ordering operator. This allows 'GROUP BY foo ORDER BY foo DESC' to be done with only one sort step.
* Add add_missing_from GUC variable.Bruce Momjian2003-06-11
| | | | Nigel J. Andrews
* Implement outer-level aggregates to conform to the SQL spec, withTom Lane2003-06-06
| | | | | | | | extensions to support our historical behavior. An aggregate belongs to the closest query level of any of the variables in its argument, or the current query level if there are no variables (e.g., COUNT(*)). The implementation involves adding an agglevelsup field to Aggref, and treating outer aggregates like outer variables at planning time.
* markTargetListOrigin neglected to handle outer-scope Vars properly;Tom Lane2003-05-31
| | | | per report from Joe Conway.
* Ensure that in all flex lexers that are part of the backend, aTom Lane2003-05-29
| | | | | | | yy_fatal_error() call results in elog(ERROR) not exit(). This was already fixed in the main lexer and plpgsql, but extend same technique to all the other dot-l files. Also, on review of the possible calls to yy_fatal_error(), it seems safe to use elog(ERROR) not elog(FATAL).
* Adopt latest bison's spelling of 'syntax error' rather than 'parse error'Tom Lane2003-05-29
| | | | | for grammar-detected problems. Revert Makefile hack that kept it looking like the pre-bison-1.875 output.
* Replace functional-index facility with expressional indexes. Any columnTom Lane2003-05-28
| | | | | | | | | | | of an index can now be a computed expression instead of a simple variable. Restrictions on expressions are the same as for predicates (only immutable functions, no sub-selects). This fixes problems recently introduced with inlining SQL functions, because the inlining transformation is applied to both expression trees so the planner can still match them up. Along the way, improve efficiency of handling index predicates (both predicates and index expressions are now cached by the relcache) and fix 7.3 oversight that didn't record dependencies of predicate expressions.
* Cause CHAR(n) to TEXT or VARCHAR conversion to automatically strip trailingTom Lane2003-05-26
| | | | | | | | | | | | | | | | | | blanks, in hopes of reducing the surprise factor for newbies. Remove redundant operators for VARCHAR (it depends wholly on TEXT operations now). Clean up resolution of ambiguous operators/functions to avoid surprising choices for domains: domains are treated as equivalent to their base types and binary-coercibility is no longer considered a preference item when choosing among multiple operators/functions. IsBinaryCoercible now correctly reflects the notion that you need *only* relabel the type to get from type A to type B: that is, a domain is binary-coercible to its base type, but not vice versa. Various marginal cleanup, including merging the essentially duplicate resolution code in parse_func.c and parse_oper.c. Improve opr_sanity regression test to understand about binary compatibility (using pg_cast), and fix a couple of small errors in the catalogs revealed thereby. Restructure "special operator" handling to fetch operators via index opclasses rather than hardwiring assumptions about names (cleans up the pattern_ops stuff a little).
* Allow Win32 to compile under MinGW. Major changes are:Bruce Momjian2003-05-15
| | | | | | | | | | | | | | | Win32 port is now called 'win32' rather than 'win' add -lwsock32 on Win32 make gethostname() be only used when kerberos4 is enabled use /port/getopt.c new /port/opendir.c routines disable GUC unix_socket_group on Win32 convert some keywords.c symbols to KEYWORD_P to prevent conflict create new FCNTL_NONBLOCK macro to turn off socket blocking create new /include/port.h file that has /port prototypes, move out of c.h new /include/port/win32_include dir to hold missing include files work around ERROR being defined in Win32 includes
* Implement feature of new FE/BE protocol whereby RowDescription identifiesTom Lane2003-05-06
| | | | | | | | | the column by table OID and column number, if it's a simple column reference. Along the way, get rid of reskey/reskeyop fields in Resdoms. Turns out that representation was not convenient for either the planner or the executor; we can make the planner deliver exactly what the executor wants with no more effort. initdb forced due to change in stored rule representation.
* Not sure why parser() was still doing clearerr(stdin) ... but it'sTom Lane2003-05-05
| | | | *got* to be pointless.
* Extended query protocol: parse, bind, execute, describe FE/BE messages.Tom Lane2003-05-05
| | | | Only lightly tested as yet, since libpq doesn't know anything about 'em.
* When a TIMESTAMP, TIME, or INTERVAL precision is specified larger than ourTom Lane2003-05-04
| | | | | | | | | | | | implementation limits, do not issue an ERROR; instead issue a NOTICE and use the max supported value. Per pgsql-general discussion of 28-Apr, this is needed to allow easy porting from pre-7.3 releases where the limits were higher. Unrelated change in same area: accept GLOBAL TEMP/TEMPORARY as a synonym for TEMPORARY, as per pgsql-hackers discussion of 15-Apr. We previously rejected it, but that was based on a misreading of the spec --- SQL92's GLOBAL temp tables are really closer to what we have than their LOCAL ones.
* Portal and memory management infrastructure for extended query protocol.Tom Lane2003-05-02
| | | | | | | | | Both plannable queries and utility commands are now always executed within Portals, which have been revamped so that they can handle the load (they used to be good only for single SELECT queries). Restructure code to push command-completion-tag selection logic out of postgres.c, so that it won't have to be duplicated between simple and extended queries. initdb forced due to addition of a field to Query nodes.
* Infrastructure for deducing Param types from context, in the same wayTom Lane2003-04-29
| | | | | | | | | | | that the types of untyped string-literal constants are deduced (ie, when coerce_type is applied to 'em, that's what the type must be). Remove the ancient hack of storing the input Param-types array as a global variable, and put the info into ParseState instead. This touches a lot of files because of adjustment of routine parameter lists, but it's really not a large patch. Note: PREPARE statement still insists on exact specification of parameter types, but that could easily be relaxed now, if we wanted to do so.
* Code review for holdable-cursors patch. Fix error recovery, memoryTom Lane2003-04-29
| | | | | context sloppiness, some other things. Includes Neil's mopup patch of 22-Apr.
* Put back encoding-conversion step in processing of incoming queries;Tom Lane2003-04-27
| | | | | | | | | | I had inadvertently omitted it while rearranging things to support length-counted incoming messages. Also, change the parser's API back to accepting a 'char *' query string instead of 'StringInfo', as the latter wasn't buying us anything except overhead. (I think when I put it in I had some notion of making the parser API 8-bit-clean, but seeing that flex depends on null-terminated input, that's not really ever gonna happen.)
* Infrastructure for upgraded error reporting mechanism. elog.c isTom Lane2003-04-24
| | | | | | | rewritten and the protocol is changed, but most elog calls are still elog calls. Also, we need to contemplate mechanisms for controlling all this functionality --- eg, how much stuff should appear in the postmaster log? And what API should libpq expose for it?
* Remove premature attempt to constant-fold type coercion expressions.Tom Lane2003-04-10
| | | | | While usually safe, this fails if the coercion function needs the query snapshot to be set already. Per example from Nigel Andrews.
* First phase of work on array improvements. ARRAY[x,y,z] constructorTom Lane2003-04-08
| | | | | | | expressions, ARRAY(sub-SELECT) expressions, some array functions. Polymorphic functions using ANYARRAY/ANYELEMENT argument and return types. Some regression tests in place, documentation is lacking. Joe Conway, with some kibitzing from Tom Lane.
* Repair incorrect checking of grouped/ungrouped variables in the presenceTom Lane2003-04-03
| | | | of unnamed joins; per pghackers discussion 31-Mar-03.
* Add missing semicolon.Tom Lane2003-04-01
|
* This patch implements holdable cursors, following the proposalBruce Momjian2003-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (materialization into a tuple store) discussed on pgsql-hackers earlier. I've updated the documentation and the regression tests. Notes on the implementation: - I needed to change the tuple store API slightly -- it assumes that it won't be used to hold data across transaction boundaries, so the temp files that it uses for on-disk storage are automatically reclaimed at end-of-transaction. I added a flag to tuplestore_begin_heap() to control this behavior. Is changing the tuple store API in this fashion OK? - in order to store executor results in a tuple store, I added a new CommandDest. This works well for the most part, with one exception: the current DestFunction API doesn't provide enough information to allow the Executor to store results into an arbitrary tuple store (where the particular tuple store to use is chosen by the call site of ExecutorRun). To workaround this, I've temporarily hacked up a solution that works, but is not ideal: since the receiveTuple DestFunction is passed the portal name, we can use that to lookup the Portal data structure for the cursor and then use that to get at the tuple store the Portal is using. This unnecessarily ties the Portal code with the tupleReceiver code, but it works... The proper fix for this is probably to change the DestFunction API -- Tom suggested passing the full QueryDesc to the receiveTuple function. In that case, callers of ExecutorRun could "subclass" QueryDesc to add any additional fields that their particular CommandDest needed to get access to. This approach would work, but I'd like to think about it for a little bit longer before deciding which route to go. In the mean time, the code works fine, so I don't think a fix is urgent. - (semi-related) I added a NO SCROLL keyword to DECLARE CURSOR, and adjusted the behavior of SCROLL in accordance with the discussion on -hackers. - (unrelated) Cleaned up some SGML markup in sql.sgml, copy.sgml Neil Conway
* Adjust subquery qual pushdown rules to be more forgiving: if a qualTom Lane2003-03-22
| | | | | | | | | refers to a non-DISTINCT output column of a DISTINCT ON subquery, or if it refers to a function-returning-set, we cannot push it down. But the old implementation refused to push down *any* quals if the subquery had any such 'dangerous' outputs. Now we just look at the output columns actually referenced by each qual expression. More code than before, but probably no slower since we don't make unnecessary checks.
* Add ALTER TABLE <tablename> CLUSTER ON <indexname>Bruce Momjian2003-03-20
| | | | Alvaro Herrera
* Todo items:Bruce Momjian2003-03-20
| | | | | | | | | | | | | | | | | | | Add ALTER SEQUENCE to modify min/max/increment/cache/cycle values Also updated create sequence docs to mention NO MINVALUE, & NO MAXVALUE. New Files: doc/src/sgml/ref/alter_sequence.sgml src/test/regress/expected/sequence.out src/test/regress/sql/sequence.sql ALTER SEQUENCE is NOT transactional. It behaves similarly to setval(). It matches the proposed SQL200N spec, as well as Oracle in most ways -- Oracle lacks RESTART WITH for some strange reason. -- Rod Taylor <rbt@rbt.ca>
* Implement SQL92-compatible FIRST, LAST, ABSOLUTE n, RELATIVE n optionsTom Lane2003-03-11
| | | | for FETCH and MOVE.
* Restructure parsetree representation of DECLARE CURSOR: now it's aTom Lane2003-03-10
| | | | | | | | | | | | utility statement (DeclareCursorStmt) with a SELECT query dangling from it, rather than a SELECT query with a few unusual fields in it. Add code to determine whether a planned query can safely be run backwards. If DECLARE CURSOR specifies SCROLL, ensure that the plan can be run backwards by adding a Materialize plan node if it can't. Without SCROLL, you get an error if you try to fetch backwards from a cursor that can't handle it. (There is still some discussion about what the exact behavior should be, but this is necessary infrastructure in any case.) Along the way, make EXPLAIN DECLARE CURSOR work.
* Back out LOCKTAG changes by Rod Taylor, pending code review. Sorry.Bruce Momjian2003-02-19
|
* - Modifies LOCKTAG to include a 'classId'. Relation receive a classId ofBruce Momjian2003-02-19
| | | | | | | | | | | | | | | | | RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed to objId. - LockObject() and UnlockObject() functions created, and their use sprinkled throughout the code to do descent locking for domains and types. They accept lock modes AccessShare and AccessExclusive, as we only really need a 'read' and 'write' lock at the moment. Most locking cases are held until the end of the transaction. This fixes the cases Tom mentioned earlier in regards to locking with Domains. If the patch is good, I'll work on cleaning up issues with other database objects that have this problem (most of them). Rod Taylor
* COALESCE() and NULLIF() are now first-class expressions, not macrosTom Lane2003-02-16
| | | | | that turn into CASE expressions. They evaluate their arguments at most once. Patch by Kris Jurka, review and (very light) editorializing by me.
* Parser was dropping foreign-key constraints on the floor if present inTom Lane2003-02-13
| | | | an ALTER TABLE ADD COLUMN command. Per bug #896.
* Arrange to give error when a SetOp member statement refers to a variableTom Lane2003-02-13
| | | | | | | | of the containing query (which really can only happen in a rule context). Per example from Brandon Craig Rhodes. Also, make the error message more specific for the similar case with sub-select in FROM. The revised coding should be easier to adapt to SQL99's LATERAL(), when we get around to supporting that.
* transformExpr() was missing some cases it ought to allow; per reportTom Lane2003-02-13
| | | | | | | from Greg Stark. Also, twiddle the FuncCall case to not scribble on the input structure, which was the proximate cause of the problem. Someday we ought to fix things so that transformExpr() isn't called on already-transformed trees ...
* [ Revert patch ]Bruce Momjian2003-02-13
| | | | | | | | | | | | | | | | | > ================================================================= > User interface proposal for multi-row function targetlist entries > ================================================================= > 1. Only one targetlist entry may return a set. > 2. Each targetlist item (other than the set returning one) is > repeated for each item in the returned set. > Having gotten no objections (actually, no response at all), I can only assume no one had heartburn with this change. The attached patch covers the first of the two proposals, i.e. restricting the target list to only one set returning function. Joe Conway