aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
Commit message (Collapse)AuthorAge
* Repair incorrect check for coercion of unknown literal to ANYARRAY, a bugTom Lane2006-10-11
| | | | | | | | | | | | I introduced in 7.4.1 :-(. It's correct to allow unknown to be coerced to ANY or ANYELEMENT, since it's a real-enough data type, but it most certainly isn't an array datatype. This can cause a backend crash but AFAICT is not exploitable as a security hole. Per report from Michael Fuhr. Note: as fixed in HEAD, this changes a constant in the pg_stats view, resulting in a change in the expected regression outputs. The back-branch patches have been hacked to avoid that, so that pre-existing installations won't start failing their regression tests.
* CREATE TABLE ... LIKE ... should mark the columns it creates withTom Lane2006-10-11
| | | | | | | | attislocal = true, since they are not really inherited but merely copied from the original table. I'm not sure if there are any cases where it makes a real difference given the existing uses of the flag, but wrong is wrong. This was fixed in passing in HEAD by the LIKE INCLUDING CONSTRAINTS patch, but never back-patched.
* Add a new GUC parameter backslash_quote, which determines whether the SQLTom Lane2006-05-21
| | | | | | | | | | | | | | | | | parser will allow "\'" to be used to represent a literal quote mark. The "\'" representation has been deprecated for some time in favor of the SQL-standard representation "''" (two single quote marks), but it has been used often enough that just disallowing it immediately won't do. Hence backslash_quote allows the settings "on", "off", and "safe_encoding", the last meaning to allow "\'" only if client_encoding is a valid server encoding. That is now the default, and the reason is that in encodings such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a multibyte character, accepting "\'" allows SQL-injection attacks as per CVE-2006-2314 (further details will be published after release). The "on" setting is available for backward compatibility, but it must not be used with clients that are exposed to untrusted input. Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue.
* Repair problems with the result of lookup_rowtype_tupdesc() possibly beingTom Lane2006-01-17
| | | | | | | discarded by cache flush while still in use. This is a minimal patch that just copies the tupdesc anywhere it could be needed across a flush. Applied to back branches only; Neil Conway is working on a better long-term solution for HEAD.
* We neglected to apply domain constraints on UNKNOWN parameters toNeil Conway2006-01-12
| | | | prepared statements, per report from David Wheeler.
* Fix a *different* problem with whole-row Vars afflicting 8.0 branch.Tom Lane2005-12-14
| | | | This is a back-port of a fix made to markTargetListOrigin() on 2005-04-25.
* Fix performance issue in exprTypmod(): for a COALESCE expression, itTom Lane2005-11-18
| | | | | | recursed twice on its first argument, leading to exponential time spent on a deep nest of COALESCEs ... such as a deeply nested FULL JOIN would produce. Per report from Matt Carter.
* Force the second argument of SUBSTRING(foo FOR bar) to be int4, to avoidTom Lane2005-11-13
| | | | | | | surprising results when it's some other numeric type. This doesn't solve the generic problem of surprising implicit casts to text, but it's a low-impact way of making sure this particular case behaves sanely. Per gripe from Harald Fuchs and subsequent discussion.
* Reject operator names >= NAMEDATALEN characters. These will not workTom Lane2005-08-16
| | | | | anyway, and in assert-enabled builds you are likely to get an assertion failure. Backpatch as far as 7.3; 7.2 seems not to have the problem.
* expandRTE and get_rte_attribute_type mistakenly always imputed typmod -1Tom Lane2005-05-29
| | | | | | to columns of an RTE that was a function returning RECORD with a column definition list. Apparently no one has tried to use non-default typmod with a function returning RECORD before.
* Fix previous patch to exprTypmod.Tatsuo Ishii2005-05-25
|
* Inserting 5 characters into char(10) does not produce 5 padding spacesTatsuo Ishii2005-05-24
| | | | | | if they are two-byte multibyte characters. Same thing can be happen if octet_length(multibyte_chars) == n where n is char(n). Long standing bug since 7.3 days. Per report and fix from Yoshiyuki Asaba.
* Ensure that the resolved datatype of any unknown Param is propagatedTom Lane2005-02-19
| | | | | into the sub-SELECT targetlist when it appears in the context INSERT INTO foo SELECT $1 ... Per report from Abhijit Menon-Sen.
* get_names_for_var didn't do recursion for unnamed JOIN vars quite right;Tom Lane2005-01-13
| | | | | | | got it wrong when the JOIN was in an outer query level. Per example from Laurie Burrow. Also fix same issue in markTargetListOrigin. I think the latter is only a latent bug since we currently don't apply markTargetListOrigin except at the outer level ... but should do it right anyway.
* Re-allow an untyped literal as the test expression of a CASE, ieTom Lane2005-01-12
| | | | | | CASE 'a' WHEN 'a' THEN 1 ELSE 2 END. This worked in 7.4 and before but had been broken due to premature freezing of the type of the test expression. Per gripe from GÄbor SzÃcs.
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-31
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Disallow SETOF in the input of parseTypeString(). Formerly it wasTom Lane2004-12-15
| | | | | | | silently ignored, allowing one to write bizarre things like DECLARE x setof int; in plpgsql. This has misled at least one novice into thinking that plpgsql variables could be sets ...
* Instead of supposing (wrongly, in the general case) that the rowtypeTom Lane2004-12-11
| | | | | | | | of an inheritance child table is binary-compatible with the rowtype of its parent, invent an expression node type that does the conversion correctly. Fixes the new bug exhibited by Kris Shannon as well as a lot of old bugs that would only show up when using multiple inheritance or after altering the parent table.
* Prevent a backend crash when processing CREATE TABLE commands withNeil Conway2004-11-16
| | | | | | | | more than 65K columns, or when the created table has more than 65K columns due to adding inherited columns from parent relations. Fix a similar crash when processing SELECT queries with more than 65K target list entries. In all three cases we would eventually detect the error and elog, but the check was being made too late.
* Kris Jurka pointed out that the qualified_name production wasn'tTom Lane2004-11-08
| | | | | | | | | | working as intended --- for some reason, FROM a.b.c was getting parsed as if it were a function name and not a qualified name. I think there must be a bug in bison, because it should have complained that the grammar was ambiguous. Anyway, fix it along the same lines previously used for func_name vs columnref, and get rid of the right-recursion in attrs that seems to have confused bison.
* When implementing a coercion to a domain type with a combinedTom Lane2004-11-06
| | | | | | type-and-length coercion function, make sure that the coercion function is told the correct typmod. Fixes Kris Jurka's example of a domain over bit(N).
* Create 'default_tablespace' GUC variable that supplies a TABLESPACETom Lane2004-11-05
| | | | | | | | | | clause implicitly whenever one is not given explicitly. Remove concept of a schema having an associated tablespace, and simplify the rules for selecting a default tablespace for a table or index. It's now just (a) explicit TABLESPACE clause; (b) default_tablespace if that's not an empty string; (c) database's default. This will allow pg_dump to use SET commands instead of tablespace clauses to determine object locations (but I didn't actually make it do so). All per recent discussions.
* Make error message more verbose, in hopes of avoiding misunderstandingsTom Lane2004-10-25
| | | | such as bug #1293.
* Allow functions returning void or cstring to appear in FROM clause,Tom Lane2004-10-20
| | | | | | to make life cushy for the JDBC driver. Centralize the decision-making that affects this by inventing a get_type_func_class() function, rather than adding special cases in half a dozen places.
* Code review for NOWAIT patch: downgrade NOWAIT from fully reserved keywordTom Lane2004-10-01
| | | | | | to unreserved keyword, use ereport not elog, assign a separate error code for 'could not obtain lock' so that applications will be able to detect that case cleanly.
* Come to think of it, functions in FROM have the same syntactic restrictionTom Lane2004-09-30
| | | | | as CREATE INDEX did, and can be fixed the same way, for another small improvement in usability and reduction in grammar size.
* Split out everything that looks like a function call from c_expr intoTom Lane2004-09-29
| | | | | | | | a separate production func_expr. This allows us to accept all these variants in the backwards-compatible syntax for creating a functional index; which beats documenting exactly which things work and which don't. Interestingly, it also seems to make the generated state machine a little bit smaller.
* A few minor list-related cleanups:Neil Conway2004-09-27
| | | | | | | | | | | (1) Replace while loop with the new forboth() construct in parser/analyze.c (2) Replace lcons() with lappend() in SearchCatCacheList(). Since these now have the same performance, there is no reason to prefer lcons() in this case, and using lappend() leads to cleaner code. (3) Improve the name of the second parameter to for_each_cell()
* Added a call to gettext() to fix broken translated error messages.Dennis Bjorklund2004-09-09
|
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Allow second and subsequent names in a qualified (dotted) name to beTom Lane2004-08-24
| | | | | | ColLabel instead of just ColId --- that is, any keyword can appear after a dot and it will be taken as an identifier. Fixes problems with names that are okay as standalone function names but fail when qualified.
* Code review for ALTER INDEX patch.Tom Lane2004-08-22
|
* Add ALTER INDEX, particularly for moving tablespaces.Bruce Momjian2004-08-20
| | | | Gavin Sherry
* Repair some issues with column aliases and RowExpr construction in theTom Lane2004-08-19
| | | | | | | | | | | | presence of dropped columns. Document the already-presumed fact that eref aliases in relation RTEs are supposed to have entries for dropped columns; cause the user alias structs to have such entries too, so that there's always a one-to-one mapping to the underlying physical attnums. Adjust expandRTE() and related code to handle the case where a column that is part of a JOIN has been dropped. Generalize expandRTE()'s API so that it can be used in a couple of places that formerly rolled their own implementation of the same logic. Fix ruleutils.c to suppress display of aliases for columns that were dropped since the rule was made.
* Standardize on the assumption that the arguments of a RowExpr correspondTom Lane2004-08-17
| | | | | | | to the physical layout of the rowtype, ie, there are dummy arguments corresponding to any dropped columns in the rowtype. We formerly had a couple of places that did it this way and several others that did not. Fixes Gaetano Mendola's "cache lookup failed for type 0" bug of 5-Aug.
* Allow commas in BEGIN, START TRANSACTION, and SET TRANSACTION, as requiredTom Lane2004-08-12
| | | | | | by the SQL standard. For backwards compatibility, however, continue to accept the syntax without. Minor editorialization in the reference pages for these commands, too.
* Allow optional SAVEPOINT keyword in RELEASE and ROLLBACK TO, for greaterTom Lane2004-08-12
| | | | | | compliance with SQL2003 spec syntax. Oliver Jowett
* Support USING INDEX TABLESPACE clause for PRIMARY KEY and UNIQUETom Lane2004-08-02
| | | | constraints. Christopher Kings-Lynne.
* Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane2004-07-27
| | | | | | | SAVEPOINT/RELEASE/ROLLBACK-TO syntax. (Alvaro) Cause COMMIT of a failed transaction to report ROLLBACK instead of COMMIT in its command tag. (Tom) Fix a few loose ends in the nested-transactions stuff.
* Remove TABLESPACE option of CREATE SEQUENCE; sequences will now alwaysTom Lane2004-07-12
| | | | | | | live in database or schema's default tablespace, as per today's discussion. Also, remove some unused keywords from the grammar (PATH, PENDANT, VERSION), and fix ALSO, which was added as a keyword but not added to the keyword classification lists, thus making it worse-than-reserved.
* ALTER TABLE SET TABLESPACE. Gavin Sherry, some rework by Tom Lane.Tom Lane2004-07-11
|
* Remove some no-longer-needed #includes.Tom Lane2004-06-28
|
* Fix some bogus code in ConstBit production --- it managed to work, butTom Lane2004-06-28
| | | | | | only because 14627 still contained the same node that BitWithoutLength had just produced. Make it more transparent. Also adjust ConstCharacter to be coded the same way for consistency.
* Support renaming of tablespaces, and changing the owners ofTom Lane2004-06-25
| | | | | | | | aggregates, conversions, functions, operators, operator classes, schemas, types, and tablespaces. Fold the existing implementations of alter domain owner and alter database owner in with these. Christopher Kings-Lynne
* Fix oversight in recent rowtype-handling improvements: transformTargetListTom Lane2004-06-19
| | | | | | should recognize 'foo.*' when the star appears in A_Indirection, not only in ColumnRef. This allows 'SELECT something.*' to do what the user expects when the something is an expression yielding a row.
* Tablespaces. Alternate database locations are dead, long live tablespaces.Tom Lane2004-06-18
| | | | | | | | | There are various things left to do: contrib dbsize and oid2name modules need work, and so does the documentation. Also someone should think about COMMENT ON TABLESPACE and maybe RENAME TABLESPACE. Also initlocation is dead, it just doesn't know it yet. Gavin Sherry and Tom Lane.
* Represent type-specific length coercion functions as pg_cast entries,Tom Lane2004-06-16
| | | | | | | | | | | | | | | | | eliminating the former hard-wired convention about their names. Allow pg_cast entries to represent both type coercion and length coercion in a single step --- this is represented by a function that takes an extra typmod argument, just like a length coercion function. This nicely merges the type and length coercion mechanisms into something at least a little cleaner than we had before. Make use of the single- coercion-step behavior to fix integer-to-bit coercion so that coercing to bit(n) yields the rightmost n bits of the integer instead of the leftmost n bits. This should fix recurrent complaints about the odd behavior of this coercion. Clean up the documentation of the bit string functions, and try to put it where people might actually find it. Also, get rid of the unreliable heuristics in ruleutils.c about whether to display nested coercion steps; instead require parse_coerce.c to label them properly in the first place.
* Clean up generation of default names for constraints, indexes, and serialTom Lane2004-06-10
| | | | | | | | sequences, as per recent discussion. All these names are now of the form table_column_type, with digits added if needed to make them unique. Default constraint names are chosen to be unique across their whole schema, not just within the parent object, so as to be more SQL-spec-compatible and make the information schema views more useful.
* Support assignment to subfields of composite columns in UPDATE and INSERT.Tom Lane2004-06-09
| | | | | | | | As a side effect, cause subscripts in INSERT targetlists to do something more or less sensible; previously we evaluated such subscripts and then effectively ignored them. Another side effect is that UPDATE-ing an element or slice of an array value that is NULL now produces a non-null result, namely an array containing just the assigned-to positions.