Commit Graph

27112 Commits

Author SHA1 Message Date
Tom Lane c8572986ad Allow I/O conversion casts to be applied to or from any type that is a member
of the STRING type category, thereby opening up the mechanism for user-defined
types.  This is mainly for the benefit of citext, though; there aren't likely
to be a lot of types that are all general-purpose character strings.
Per discussion with David Wheeler.
2008-07-30 21:23:17 +00:00
Tom Lane 7df49cef72 Flip the default typispreferred setting from true to false. This affects
only type categories in which the previous coding made *every* type
preferred; so there is no change in effective behavior, because the function
resolution rules only do something different when faced with a choice
between preferred and non-preferred types in the same category.  It just
seems safer and less surprising to have CREATE TYPE default to non-preferred
status ...
2008-07-30 19:35:13 +00:00
Tom Lane 42be2c790f Adjust citext to make use of the new ability to declare its type category:
by putting it into the standard string category, we cause casts from citext
to text to be recognized as "preferred" casts.  This eliminates the need
for creation of alias functions and operators that only serve to prevent
ambiguous-function errors; get rid of the ones that were in the original
commit.
2008-07-30 17:08:52 +00:00
Tom Lane bac3e83622 Replace the hard-wired type knowledge in TypeCategory() and IsPreferredType()
with system catalog lookups, as was foreseen to be necessary almost since
their creation.  Instead put the information into two new pg_type columns,
typcategory and typispreferred.  Add support for setting these when
creating a user-defined base type.

The category column is just a "char" (i.e. a poor man's enum), allowing
a crude form of user extensibility of the category list: just use an
otherwise-unused character.  This seems sufficient for foreseen uses,
but we could upgrade to having an actual category catalog someday, if
there proves to be a huge demand for custom type categories.

In this patch I have attempted to hew exactly to the behavior of the
previous hardwired logic, except for introducing new type categories for
arrays, composites, and enums.  In particular the default preferred state
for user-defined types remains TRUE.  That seems worth revisiting, but it
should be done as a separate patch from introducing the infrastructure.
Likewise, any adjustment of the standard set of categories should be done
separately.
2008-07-30 17:05:05 +00:00
Tom Lane ab9907f5e5 Add a new, improved version of citext as a contrib module.
David E. Wheeler
2008-07-29 18:31:20 +00:00
Magnus Hagander 6fe8796341 Cleanup reference to config.pl so it makes sense not only in
SGML source but in the actual web/pdf viewer...
2008-07-29 15:23:44 +00:00
Magnus Hagander f7cd591698 Document which versions of ActivePerl and ActiveTcl are required
for building on MSVC, and that the free distribution is enough
(no need for the enterprise version).

Per gripe from Martin Zaun.
2008-07-29 15:17:27 +00:00
Tom Lane a77eaa6a95 As noted by Andrew Gierth, there's really no need any more to force a junk
filter to be used when INSERT or SELECT INTO has a plan that returns raw
disk tuples.  The virtual-tuple-slot optimizations that were put in place
awhile ago mean that ExecInsert has to do ExecMaterializeSlot, and that
already copies the tuple if it's raw (and does so more efficiently than
a junk filter, too).  So get rid of that logic.  This in turn means that
we can throw away ExecMayReturnRawTuples, which wasn't used for any other
purpose, and was always a kluge anyway.

In passing, move a couple of SELECT-INTO-specific fields out of EState
and into the private state of the SELECT INTO DestReceiver, as was foreseen
in an old comment there.  Also make intorel_receive use ExecMaterializeSlot
not ExecCopySlotTuple, for consistency with ExecInsert and to possibly save
a tuple copy step in some cases.
2008-07-26 19:15:35 +00:00
Tom Lane 94be06af76 Fix parsing of LDAP URLs so it doesn't reject spaces in the "suffix" part.
Per report from César Miguel Oliveira Alves.
2008-07-24 17:51:55 +00:00
Tom Lane e76ef8d581 Remove some redundant tests and improve comments in next_token().
Cosmetic, but it might make this a bit less confusing to the next reader.
2008-07-24 17:43:45 +00:00
Alvaro Herrera 85dfe376d9 Ratchet up patch to improve autovacuum wraparound messages.
Simon Riggs
2008-07-23 20:20:10 +00:00
Tom Lane 11c794f224 Use guc.c's parse_int() instead of pg_atoi() to parse fillfactor in
default_reloptions().  The previous coding was really a bug because pg_atoi()
will always throw elog on bad input data, whereas default_reloptions is not
supposed to complain about bad input unless its validate parameter is true.
Right now you could only expose the problem by hand-modifying
pg_class.reloptions into an invalid state, so it doesn't seem worth
back-patching; but we should get it right in HEAD because there might be other
situations in future.  Noted while studying GIN fast-update patch.
2008-07-23 17:29:53 +00:00
Peter Eisentraut 509303a597 Abort if Tcl support was configured and no tcl shell was found.
This is required because the value is substituted into the pltcl_*mod
scripts.
2008-07-23 17:07:50 +00:00
Tom Lane 64d84adf03 Update link to Oleg and Teodor's GIN page.
(Extracted from fast-insert patch, since it ought to be back-patched)
2008-07-22 22:05:24 +00:00
Alvaro Herrera 0d09688f88 Publish more openly the fact that autovacuum is working for wraparound
protection.

Simon Riggs
2008-07-21 15:27:02 +00:00
Tom Lane b351eba20a Add comment about the two different query strings that ExecuteQuery()
has to deal with.
2008-07-21 15:26:55 +00:00
Tom Lane 5618ece82b Code review for array_fill patch: fix inadequate check for array size overflow
and bogus documentation (dimension arrays are int[] not anyarray).  Also the
errhint() messages seem to be really errdetail(), since there is nothing
heuristic about them.  Some other trivial cosmetic improvements.
2008-07-21 04:47:00 +00:00
Tom Lane 673a30fbb2 Add a pg_dump option --lock-wait-timeout to allow failing the dump if unable
to acquire shared table locks within a specified amount of time.

David Gould
2008-07-20 18:43:30 +00:00
Bruce Momjian b133ceb77d Revert patch so .psqlrc can suppress startup banner:
In psql, run .psqlrc _after_ printing warnings and banner.
2008-07-20 06:08:38 +00:00
Tom Lane 4b362c662e Avoid substituting NAMEDATALEN, FLOAT4PASSBYVAL, and FLOAT8PASSBYVAL into
the postgres.bki file during build, because we want that file to be entirely
platform- and configuration-independent; else it can't safely be put into
/usr/share on multiarch machines.  We can do the substitution during initdb,
instead.  FLOAT4PASSBYVAL and FLOAT8PASSBYVAL are new breakage as of 8.4,
while the NAMEDATALEN hazard has been there all along but I guess no one
tripped over it.  Noticed while trying to build "universal" OS X binaries.
2008-07-19 04:01:29 +00:00
Tom Lane a1c692358b Adjust things so that the query_string of a cached plan and the sourceText of
a portal are never NULL, but reliably provide the source text of the query.
It turns out that there was only one place that was really taking a short-cut,
which was the 'EXECUTE' utility statement.  That doesn't seem like a
sufficiently critical performance hotspot to justify not offering a guarantee
of validity of the portal source text.  Fix it to copy the source text over
from the cached plan.  Add Asserts in the places that set up cached plans and
portals to reject null source strings, and simplify a bunch of places that
formerly needed to guard against nulls.

There may be a few places that cons up statements for execution without
having any source text at all; I found one such in ConvertTriggerToFK().
It seems sufficient to inject a phony source string in such a case,
for instance
        ProcessUtility((Node *) atstmt,
                       "(generated ALTER TABLE ADD FOREIGN KEY command)",
                       NULL, false, None_Receiver, NULL);

We should take a second look at the usage of debug_query_string,
particularly the recently added current_query() SQL function.

ITAGAKI Takahiro and Tom Lane
2008-07-18 20:26:06 +00:00
Tom Lane 6cc88f0af5 Provide a function hook to let plug-ins get control around ExecutorRun.
ITAGAKI Takahiro
2008-07-18 18:23:47 +00:00
Bruce Momjian 8d7af89016 Properly document archive/restore command examples on Windows.
ITAGAKI Takahiro
2008-07-18 17:33:17 +00:00
Bruce Momjian 25c9de4d84 In psql, run .psqlrc _after_ printing warnings and banner. 2008-07-18 17:19:55 +00:00
Tom Lane dc02a4814a Fix a race condition that I introduced into sinvaladt.c during the recent
rewrite.  When called from SIInsertDataEntries, SICleanupQueue releases
the write lock if it has to issue a kill() to signal some laggard backend.
That still seems like a good idea --- but it's possible that by the time
we get the lock back, there are no longer enough free message slots to
satisfy SIInsertDataEntries' requirement.  Must recheck, and repeat the
whole SICleanupQueue process if not.  Noted while reading code.
2008-07-18 14:45:48 +00:00
Tom Lane a4775a80fd Suppress compiler warning, and not incidentally make the code more
robust.  The previous coding was quite risky because it was testing
conditions different from 'is the array really allocated?'.
2008-07-18 04:20:24 +00:00
Tom Lane 69a785b8bf Implement SQL-spec RETURNS TABLE syntax for functions.
(Unlike the original submission, this patch treats TABLE output parameters
as being entirely equivalent to OUT parameters -- tgl)

Pavel Stehule
2008-07-18 03:32:53 +00:00
Bruce Momjian a8fb90cf2d Add URL for:
* Implement SQL:2003 window functions

>   http://archives.postgresql.org/pgsql-hackers/2008-07/msg00232.php
2008-07-18 02:03:28 +00:00
Alvaro Herrera d557f5c00c Add MSVC++ debug libraries to .cvsignore. 2008-07-17 21:16:23 +00:00
Alvaro Herrera 46c5a212ec Avoid crashing when a table is deleted while we're on the process of checking
it.

Per report from Tom Lane based on buildfarm evidence.
2008-07-17 21:02:31 +00:00
Tom Lane a41f73a092 Add dump support for SortBy nodes. Needed this while debugging a reported
problem with DISTINCT, so might as well commit it.
2008-07-17 16:02:12 +00:00
Bruce Momjian ba38e363ac Add to TODO:
>
> * Reduce locking requirements for creating a trigger
>
>   http://archives.postgresql.org/pgsql-hackers/2008-06/msg00635.php
>
2008-07-17 01:34:33 +00:00
Bruce Momjian 9a3118d454 Add URL for:
* Implement SQL:2003 window functions
>
>   http://archives.postgresql.org/pgsql-hackers/2008-06/msg00380.php
>
2008-07-16 21:03:45 +00:00
Tom Lane 5ef5abe372 Fix previous patch so that it actually works --- consider TRUNCATE foo, public.foo 2008-07-16 19:33:25 +00:00
Tom Lane 6563e9e2e8 Add a "provariadic" column to pg_proc to eliminate the remarkably expensive
need to deconstruct proargmodes for each pg_proc entry inspected by
FuncnameGetCandidates().  Fixes function lookup performance regression
caused by yesterday's variadic-functions patch.

In passing, make pg_proc.probin be NULL, rather than a dummy value '-',
in cases where it is not actually used for the particular type of function.
This should buy back some of the space cost of the extra column.
2008-07-16 16:55:24 +00:00
Bruce Momjian 895a4bccb6 Allow TRUNCATE foo, foo to succeed, per report from Nikhils. 2008-07-16 16:54:08 +00:00
Bruce Momjian 9c8f74917d Add to TODO:
>
> 	o Add external tool to auto-tune some postgresql.conf parameters
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-06/msg00000.php
>
2008-07-16 15:30:19 +00:00
Tom Lane d89737d31c Support "variadic" functions, which can accept a variable number of arguments
so long as all the trailing arguments are of the same (non-array) type.
The function receives them as a single array argument (which is why they
have to all be the same type).

It might be useful to extend this facility to aggregates, but this patch
doesn't do that.

This patch imposes a noticeable slowdown on function lookup --- a follow-on
patch will fix that by adding a redundant column to pg_proc.

Pavel Stehule
2008-07-16 01:30:23 +00:00
Bruce Momjian 2c773296f8 Add array_fill() to create arrays initialized with a value.
Pavel Stehule
2008-07-16 00:48:54 +00:00
Bruce Momjian 2fa42cc9ee Fix alignment of SGML array docs. 2008-07-15 18:24:59 +00:00
Bruce Momjian bd53eb4b05 Add Swedish_Sweden.1252 Windows locale example to docs. 2008-07-15 17:45:03 +00:00
Bruce Momjian 590510136e Addendum: psql sequence value display patch was originally written by
Euler Taveira de Oliveira.
2008-07-15 16:06:06 +00:00
Bruce Momjian d3c94b2d84 Add to TODO:
>
> 	o Reduce PITR WAL file size by removing full page writes and
> 	  by removing trailing bytes to improve compression
2008-07-15 15:03:41 +00:00
Bruce Momjian 13e835932b Add TODO:
>
> * Consider decreasing the I/O caused by updating tuple hint bits
>
>   http://archives.postgresql.org/pgsql-hackers/2008-05/msg00847.php
>
2008-07-15 13:55:20 +00:00
Bruce Momjian db13b7d61f Done:
> 	o -Have psql show current values for a sequence
2008-07-15 03:17:51 +00:00
Bruce Momjian 8516ce0914 Have psql \d show the value of sequence columns.
Dickson S. Guedes
2008-07-15 03:16:03 +00:00
Bruce Momjian da0a9f1d5a Clarify that locale names on Windows are more verbose.
Report from Martin Saschek
2008-07-15 01:35:23 +00:00
Bruce Momjian bf523f97ca Add comment about literal strings in our syntax not being translated in
psql.
2008-07-14 23:13:04 +00:00
Bruce Momjian e39a3dfa86 Add to TODO:
> * Improve ability to modify views via ALTER TABLE
>
>   http://archives.postgresql.org/pgsql-hackers/2008-05/msg00691.php
2008-07-14 22:57:21 +00:00
Bruce Momjian 71e0296dbc Add column storage type to psql \d+ display.
Gregory Stark
2008-07-14 22:51:48 +00:00