Commit Graph

28982 Commits

Author SHA1 Message Date
Bruce Momjian fe83b975b2 Document ath vacuumdb --analyze does analyze _also_, not in place of
vacuum.
2009-11-27 17:41:26 +00:00
Michael Meskes bb28e83636 Remove */ characters from declare cursor statements before putting them into a
comment.
2009-11-27 16:07:22 +00:00
Michael Meskes d7d5c6857b If no result is given NOTFOUND should be returned. Check for empty result
string too.
2009-11-27 13:32:17 +00:00
Michael Meskes 81a82a13b2 Added script to check if all rule re-definition in ecpg.addons are indeed used
in the build process. If not the build process will stop with an error message.
2009-11-27 10:00:40 +00:00
Tom Lane f0edaecd48 Fix missing end tag, per Jeff Davis. 2009-11-26 21:20:12 +00:00
Michael Meskes 280744d461 Added missing files. 2009-11-26 15:55:57 +00:00
Michael Meskes c48d48d41f Forgot to add dynamic cursors to Changelog. 2009-11-26 15:40:43 +00:00
Michael Meskes fb9d62805d Synced addon rules after some renamings. 2009-11-26 15:39:26 +00:00
Michael Meskes a160c421a5 Added dynamic cursor names to ecpg. Almost the whole patch was done by
Boszormenyi Zoltan, with only a minor tweak or two from me.
2009-11-26 15:06:47 +00:00
Tom Lane da29cc8022 Simplify psql's new linestyle behavior to default to linestyle=ascii all
the time, rather than hoping we can tell whether the terminal supports
UTF8 characters.  Per discussion.
2009-11-25 20:26:31 +00:00
Peter Eisentraut f6a79c5901 Fix syntax in extract() examples
Author: Erik Rijkers <er@xs4all.nl>
2009-11-24 19:21:15 +00:00
Michael Meskes 14cc1ed7ed Made function better readable. 2009-11-24 16:30:31 +00:00
Peter Eisentraut 6e3117c3c9 Add PG_MODULE_MAGIC and some missing include files to examples
Author: Euler Taveira de Oliveira <euler@timbira.com>
2009-11-23 21:41:20 +00:00
Tom Lane 8d97c1dcfa Use diff's -w switch only on Windows, to avoid problems with inconsistent
newline representations.  Per buildfarm results and subsequent discussion.
Sync up a couple of other places that had their own policies.
2009-11-23 16:02:24 +00:00
Magnus Hagander fe4b8c42ad Add missing library to standalone libpq build on Win32.
Hiroshi Saito
2009-11-23 12:54:37 +00:00
Heikki Linnakangas cd87b6f8a5 Fix an old bug in multixact and two-phase commit. Prepared transactions can
be part of multixacts, so allocate a slot for each prepared transaction in
the "oldest member" array in multixact.c. On PREPARE TRANSACTION, transfer
the oldest member value from the current backends slot to the prepared xact
slot. Also save and recover the value from the 2pc state file.

The symptom of the bug was that after a transaction prepared, a shared lock
still held by the prepared transaction was sometimes ignored by other
transactions.

Fix back to 8.1, where both 2PC and multixact were introduced.
2009-11-23 09:58:36 +00:00
Tom Lane c194ff20d2 Assorted wordsmithing on the documentation of \pset --- try to make it
a bit more consistent and less obviously written by different people at
different times.
2009-11-22 22:06:30 +00:00
Tom Lane 1fe419279c Adjust expected-results spacing per buildfarm results. 2009-11-22 20:58:51 +00:00
Tom Lane ce3153fa93 Remove -w (--ignore-all-space) option from pg_regress's diff calls.
We have used -w for a long time as a means of reducing the reported diff
volume when one element of a result table isn't of the expected width.
However, most of the time the results just pass anyway, so this isn't as
important as it once was.  Meanwhile, the risk of missing potentially
significant deviations has gone up, particularly with psql's ability to
report error cursor positions.  So, let's switch over to space-sensitive
comparisons.  Per my proposal of yesterday.

(All the expected files that I can test here seem to be ready for this
already, but we'll see what the buildfarm thinks about others.)
2009-11-22 17:54:23 +00:00
Heikki Linnakangas 997a6a278f Remove superfluous curly brace, fixing compilation with OPTIMIZER_DEBUG.
Jan Urbanski
2009-11-22 14:54:31 +00:00
Tom Lane 1c499591f4 Ooops, forgot to check the libxml cases for psql output wrapping change. 2009-11-22 06:01:09 +00:00
Tom Lane 1753337cf5 Improve psql's tabular display of wrapped-around data by inserting markers
in the formerly-always-blank columns just to left and right of the data.
Different marking is used for a line break caused by a newline in the data
than for a straight wraparound.  A newline break is signaled by a "+" in the
right margin column in ASCII mode, or a carriage return arrow in UNICODE mode.
Wraparound is signaled by a dot in the right margin as well as the following
left margin in ASCII mode, or an ellipsis symbol in the same places in UNICODE
mode.  "\pset linestyle old-ascii" is added to make the previous behavior
available if anyone really wants it.

In passing, this commit also cleans up a few regression test files that
had unintended spacing differences from the current actual output.

Roger Leigh, reviewed by Gabrielle Roth and other members of PDXPUG.
2009-11-22 05:20:41 +00:00
Peter Eisentraut 93d3bac564 Ignore UTF-8-encoded Unicode byte-order mark at the beginning of a file if
the client encoding is UTF-8.

a limited version of a patch proposed by Itagaki Takahiro
2009-11-21 23:59:12 +00:00
Tom Lane e6c63bf660 Refactor ecpg grammar so that it uses the core grammar's unreserved_keyword
list, minus a few specific words that have to be treated specially.  This
replaces a hard-wired list of keywords that would have needed manual
maintenance, and was not getting it.  The 8.4 coding was already missing
these words, causing ecpg to incorrectly treat them as reserved words:
CALLED, CATALOG, DEFINER, ENUM, FOLLOWING, INVOKER, OPTIONS, PARTITION,
PRECEDING, RANGE, SECURITY, SERVER, UNBOUNDED, WRAPPER.  In HEAD we were
additionally missing COMMENTS, FUNCTIONS, SEQUENCES, TABLES.
Per gripe from Bosco Rama.
2009-11-21 05:44:05 +00:00
Tom Lane 7fc0f06221 Add a WHEN clause to CREATE TRIGGER, allowing a boolean expression to be
checked to determine whether the trigger should be fired.

For BEFORE triggers this is mostly a matter of spec compliance; but for AFTER
triggers it can provide a noticeable performance improvement, since queuing of
a deferred trigger event and re-fetching of the row(s) at end of statement can
be short-circuited if the trigger does not need to be fired.

Takahiro Itagaki, reviewed by KaiGai Kohei.
2009-11-20 20:38:12 +00:00
Peter Eisentraut 201a45c4fa Typo: dump -> restore
fixed in 8.4 and 8.5

Author: Guillaume Lelarge <guillaume@lelarge.info>
2009-11-19 22:05:48 +00:00
Tom Lane b1d55dca91 Fix memory leak in syslogger: logfile_rotate() would leak a copy of the
output filename if CSV logging was enabled and only one of the two possible
output files got rotated during a particular call (which would, in fact,
typically be the case during a size-based rotation).  This would amount to
about MAXPGPATH (1KB) per rotation, and it's been there since the CSV
code was put in, so it's surprising that nobody noticed it before.
Per bug #5196 from Thomas Poindessous.
2009-11-19 02:45:33 +00:00
Tom Lane c742b795dd Add a hook to CREATE/ALTER ROLE to allow an external module to check the
strength of database passwords, and create a sample implementation of
such a hook as a new contrib module "passwordcheck".

Laurenz Albe, reviewed by Takahiro Itagaki
2009-11-18 21:57:56 +00:00
Tom Lane 5e66a51c2e Provide a parenthesized-options syntax for VACUUM, analogous to that recently
adopted for EXPLAIN.  This will allow additional options to be implemented
in future without having to make them fully-reserved keywords.  The old syntax
remains available for existing options, however.

Itagaki Takahiro
2009-11-16 21:32:07 +00:00
Tom Lane 49ed392cd8 While doing the final setrefs.c pass over a plan tree, try to match up
non-Var sort/group expressions using ressortgroupref labels instead of
depending entirely on equal()-ity of the upper node's tlist expressions
to the lower node's.  This avoids emitting the wrong outputs in cases
where there are textually identical volatile sort/group expressions,
as for example
	select distinct random(),random() from generate_series(1,10);
Per report from Andrew Gierth.

Backpatch to 8.4.  Arguably this is wrong all the way back, but the only known
case where there's an observable problem is when using hash aggregation to
implement DISTINCT, which is new as of 8.4.  So for the moment I'll refrain
from backpatching further.
2009-11-16 18:04:40 +00:00
Peter Eisentraut 66363e8d6d Make text search parser accept underscores in XML attributes (bug #5075) 2009-11-15 13:57:01 +00:00
Tom Lane caf9c830d9 Improve planning of Materialize nodes inserted atop the inner input of a
mergejoin to shield it from doing mark/restore and refetches.  Put an explicit
flag in MergePath so we can centralize the logic that knows about this,
and add costing logic that considers using Materialize even when it's not
forced by the previously-existing considerations.  This is in response to
a discussion back in August that suggested that materializing an inner
indexscan can be helpful when the refetch percentage is high enough.
2009-11-15 02:45:35 +00:00
Tom Lane 29faadcd27 Make unaccent's install/uninstall scripts look more like all the others.
Set search_path explicitly, don't use IF EXISTS, etc.
2009-11-14 18:24:32 +00:00
Magnus Hagander da8d684d39 Add inheritable ACE when creating a restricted token for execution on
Win32.

Also refactor the code around it to be more clear.

Jesse Morris
2009-11-14 15:39:36 +00:00
Tom Lane ef679ff6b7 Clean up a couple of bizarre code formatting choices in recent CREATE LIKE patch. 2009-11-13 23:49:23 +00:00
Tom Lane 82121aff12 Avoid assuming that enum CreateStmtLikeOption is unsigned. Zdenek Kotala 2009-11-13 23:44:19 +00:00
Tom Lane 6317609986 Add control knobs for plpgsql's variable resolution behavior, and make the
default be "throw error on conflict", as per discussions.  The GUC variable
is plpgsql.variable_conflict, with values "error", "use_variable",
"use_column".  The behavior can also be specified per-function by inserting
one of
	#variable_conflict error
	#variable_conflict use_variable
	#variable_conflict use_column
at the start of the function body.

The 8.5 release notes will need to mention using "use_variable" to retain
backward-compatible behavior, although we should encourage people to migrate
to the much less mistake-prone "error" setting.

Update the plpgsql documentation to match this and other recent changes.
2009-11-13 22:43:42 +00:00
Heikki Linnakangas 01038d4ad7 A better fix for the "ARRAY[...]::domain" problem. The previous patch worked,
but the transformed ArrayExpr claimed to have a return type of "domain",
even though the domain constraint was only checked by the enclosing
CoerceToDomain node. With this fix, the ArrayExpr is correctly labeled with
the base type of the domain. Per gripe by Tom Lane.
2009-11-13 19:48:20 +00:00
Heikki Linnakangas 942702a496 When you do "ARRAY[...]::domain", where domain is a domain over an array type,
we need to check domain constraints. We used to do it correctly, but 8.4
introduced a separate code path for the "ARRAY[]::arraytype" case to infer
the type of an empty ARRAY construct from the cast target, and forgot to take
domains into account.

Per report from Florian G. Pflug.
2009-11-13 16:09:10 +00:00
Teodor Sigaev 5e75f6790c Fix multicolumn GIN's wrong results with fastupdate enabled.
User-defined consistent functions believes the check array
contains at least one true element which was not a true for
scanning pending list.

Per report from Yury Don <yura@vpcit.ru>
2009-11-13 11:17:04 +00:00
Tom Lane 0894c6b838 The recent patch to log changes in postgresql.conf settings dumped core
if the initial value of a string variable was NULL, which is entirely
possible.  Noted while experimenting with custom_variable_classes.
2009-11-12 18:20:23 +00:00
Tom Lane 8539a0e00a Check for C/POSIX before assuming that nl_langinfo or win32_langinfo
will work.  Per buildfarm results.
2009-11-12 03:37:15 +00:00
Tom Lane 8f8a5df694 Make initdb behave sanely when the selected locale has codeset "US-ASCII".
Per discussion, this should result in defaulting to SQL_ASCII encoding.
The original coding could not support that because it conflated selection
of SQL_ASCII encoding with not being able to determine the encoding.
Adjust pg_get_encoding_from_locale()'s API to distinguish these cases,
and fix callers appropriately.  Only initdb actually changes behavior,
since the other callers were perfectly content to consider these cases
equivalent.

Per bug #5178 from Boh Yap.  Not going to bother back-patching, since
no one has complained before and there's an easy workaround (namely,
specify the encoding you want).
2009-11-12 02:46:16 +00:00
Tom Lane 19d802767d Remove pg_parse_string_token() --- not needed anymore. 2009-11-12 01:13:12 +00:00
Tom Lane 2dee828cac Remove plpgsql's separate lexer (finally!), in favor of using the core lexer
directly.  This was a lot of trouble, but should be worth it in terms of
not having to keep the plpgsql lexer in step with core anymore.  In addition
the handling of keywords is significantly better-structured, allowing us to
de-reserve a number of words that plpgsql formerly treated as reserved.
2009-11-12 00:13:00 +00:00
Peter Eisentraut 60cd1f1829 In psql \du, separate the role attributes by comma instead of newline,
for an arguably more pleasant display.
2009-11-11 21:07:41 +00:00
Alvaro Herrera e9984c47e9 Change "name" nonterminal in cursor-related productions to cursor_name.
This is a preparatory patch for allowing a dynamic cursor name be used in the
ECPG grammar.

Author: Zoltan Boszormenyi
2009-11-11 20:31:26 +00:00
Alvaro Herrera af054db6ef Document the previous FETCH and MOVE changes. 2009-11-11 20:07:57 +00:00
Alvaro Herrera 2ea179f361 Support optional FROM/IN in FETCH and MOVE
The main motivation for this is that it's required for Informix compatibility
in ECPG.

This patch makes the ECPG and core grammars a bit closer to one another for
these productions.

Author: Zoltan Boszormenyi
2009-11-11 19:25:42 +00:00
Tom Lane 90bfe99963 Do not build psql's flex module on its own, but instead include it in
mainloop.c.  This ensures that postgres_fe.h is read before including
any system headers, which is necessary to avoid problems on some platforms
where we make nondefault selections of feature macros for stdio.h or
other headers.  We have had this policy for flex modules in the backend
for many years, but for some reason it was not applied to psql.
Per trouble report from Alexandra Roy and diagnosis by Albe Laurenz.
2009-11-10 23:12:13 +00:00