Commit Graph

16868 Commits

Author SHA1 Message Date
Bruce Momjian e152949ee2 Change $(CC) to $(COMPILER) on Solaris gcc so -m64 is passed into the
shared link line.
2007-02-20 22:45:57 +00:00
Tom Lane 9cbd0c155d Remove the Query structure from the executor's API. This allows us to stop
storing mostly-redundant Query trees in prepared statements, portals, etc.
To replace Query, a new node type called PlannedStmt is inserted by the
planner at the top of a completed plan tree; this carries just the fields of
Query that are still needed at runtime.  The statement lists kept in portals
etc. now consist of intermixed PlannedStmt and bare utility-statement nodes
--- no Query.  This incidentally allows us to remove some fields from Query
and Plan nodes that shouldn't have been there in the first place.

Still to do: simplify the execution-time range table; at the moment the
range table passed to the executor still contains Query trees for subqueries.

initdb forced due to change of stored rules.
2007-02-20 17:32:18 +00:00
Bruce Momjian 2d848857ee Add comment that on Win32, we don't need to check the .pgpass file
permission, per Magnus.
2007-02-20 15:20:51 +00:00
Peter Eisentraut 28b96f2a30 Identify schema of inherited table in psql \d when necessary.
by Bernd Helmle
2007-02-20 10:23:38 +00:00
Peter Eisentraut 63e03ba923 Add missing OIDs to pg_proc. 2007-02-20 10:00:25 +00:00
Bruce Momjian 3e803f7273 Add "isodow" option to EXTRACT() and date_part() where Sunday = 7. 2007-02-19 17:41:39 +00:00
Magnus Hagander 74096ed1fd Fix pg_dump on win32 to properly dump files larger than 2Gb when using
binary dump formats.
2007-02-19 15:05:06 +00:00
Magnus Hagander bc959b7bd2 Parse pg_proc.h with entries without OIDs. 2007-02-19 14:05:42 +00:00
Tom Lane 7c5e5439d2 Get rid of some old and crufty global variables in the planner. When
this code was last gone over, there wasn't really any alternative to
globals because we didn't have the PlannerInfo struct being passed all
through the planner code.  Now that we do, we can restructure things
to avoid non-reentrancy.  I'm fooling with this because otherwise I'd
have had to add another global variable for the planned compact
range table list.
2007-02-19 07:03:34 +00:00
Tom Lane 90c301aaa9 Improve plpgsql's error message when a datatype declaration is omitted.
Per example from Jeff Ross.
2007-02-19 03:18:51 +00:00
Tom Lane b8c3267792 Put function expressions and values lists into FunctionScan and ValuesScan
plan nodes, so that the executor does not need to get these items from
the range table at runtime.  This will avoid needing to include these
fields in the compact range table I'm expecting to make the executor use.
2007-02-19 02:23:12 +00:00
Tom Lane f1f2b2711a Fix portal management code to support non-default command completion tags for
portals using PORTAL_UTIL_SELECT strategy.  This is currently significant only
for FETCH queries, which are supposed to include a count in the tag.  Seems
it's been broken since 7.4, but nobody noticed before Knut Lehre.
2007-02-18 19:49:25 +00:00
Tom Lane 49451ae03e Add code so that when COPY_PARSE_PLAN_TREES is defined, the copy and
equal functions are checked for raw parse trees as well as post-analysis
trees.  This was never very important before, but the upcoming plan cache
control module will need to be able to do copyObject() on raw parse trees.
2007-02-17 19:33:32 +00:00
Bruce Momjian 4fe1a12c54 Remove rint() for to_char MS and US output. We can't us rint() because
we can't overflow to the next higher units, and we might print the lower
units for MS.
2007-02-17 03:11:32 +00:00
Bruce Momjian f7a51b7a0d Cleanup of to_char() patch.
Brendan Jurd
2007-02-17 01:51:42 +00:00
Bruce Momjian 89a624439e Create AVG() aggregates for int8 and NUMERIC which do not compute X^2,
as a performance enhancement.

Mark Kirkwood
2007-02-17 00:55:58 +00:00
Tom Lane 72a070a365 Teach find_nonnullable_rels to handle OR cases: if every arm of an OR
forces a particular relation nonnullable, then we can say that the OR does.
This is worth a little extra trouble since it may allow reduction of
outer joins to plain joins.
2007-02-16 23:32:08 +00:00
Tom Lane 9f28ac0dd3 Fix new RI operator selection code to do the right thing when working with
an opclass for a generic type such as ANYARRAY.  The original coding failed
to check that PK and FK columns were of the same array type.  Per discussion
with Tom Dunstan.  Also, make the code a shade more readable by not trying
to economize on variables.
2007-02-16 22:04:02 +00:00
Bruce Momjian 1d722cf18c Reduce the amount of memory "clobbered" for every process title change,
on platforms that need this.  This is done by only writing past the
previously stored message, if it was longer.
2007-02-16 21:34:04 +00:00
Tom Lane 8249409bc1 Adjust the definition of is_pushed_down so that it's always true for INNER
JOIN quals, just like WHERE quals, even if they reference every one of the
join's relations.  Now that we can reorder outer and inner joins, it's
possible for such a qual to end up being assigned to an outer join plan node,
and we mustn't have it treated as a join qual rather than a filter qual for
the node.  (If it were, the join could produce null-extended rows that it
shouldn't.)  Per bug report from Pelle Johansson.
2007-02-16 20:57:19 +00:00
Peter Eisentraut e472f13f99 Better fix for determining minimum and maximum int64 values that doesn't
require stdint.h and works for "busted" int64.
2007-02-16 18:37:43 +00:00
Alvaro Herrera 8d2b05df9a Install a more correct fix in the timestamp and timestamptz regression tests:
remove duplicated tests in timestamp, and complete timestamptz with the tests
that were missing to more closely mirror timestamp.
2007-02-16 17:49:15 +00:00
Tom Lane b6c9165ea0 Code review for SSLKEY patch. 2007-02-16 17:07:00 +00:00
Alvaro Herrera 7f1d68a400 Fix the timestamptz test problem, by moving the tests that use the
timestamp_tbl table into the timestamp test.  Also, restore a test that
used to exist as a valid test in the timestamptz test.
2007-02-16 15:42:42 +00:00
Peter Eisentraut 89b18bdd2a Fix // comment 2007-02-16 10:55:47 +00:00
Peter Eisentraut cf3aeb2f8b Add stdint.h include 2007-02-16 10:42:31 +00:00
Peter Eisentraut 355e05ab41 Functions for mapping table data and table schemas to XML (a.k.a. XML export) 2007-02-16 07:46:55 +00:00
Tom Lane 7ea758b0b1 Fix another problem in 8.2 changes that allowed "one-time" qual conditions to
be checked at plan levels below the top; namely, we have to allow for Result
nodes inserted just above a nestloop inner indexscan.  Should think about
using the general Param mechanism to pass down outer-relation variables, but
for the moment we need a back-patchable solution.  Per report from Phil Frost.
2007-02-16 03:49:04 +00:00
Bruce Momjian 4ebb0cf9c3 Add two new format fields for use with to_char(), to_date() and
to_timestamp():
    - ID for day-of-week
    - IDDD for day-of-year

This makes it possible to convert ISO week dates to and from text
fully represented in either week ('IYYY-IW-ID') or day-of-year
('IYYY-IDDD') format.

I have also added an 'isoyear' field for use with extract / date_part.

Brendan Jurd
2007-02-16 03:39:46 +00:00
Bruce Momjian c7b08050d9 SSL improvements:
o read global SSL configuration file
	o add GUC "ssl_ciphers" to control allowed ciphers
	o add libpq environment variable PGSSLKEY to control SSL hardware keys

Victor B. Wagner
2007-02-16 02:59:41 +00:00
Alvaro Herrera 68046a20c7 Remove useless database name from bootstrap argument processing (including
startup and bgwriter processes), and the -y flag.  It's not used anywhere.
2007-02-16 02:10:07 +00:00
Tom Lane 6bef118b01 Restructure code that is responsible for ensuring that clauseless joins are
considered when it is necessary to do so because of a join-order restriction
(that is, an outer-join or IN-subselect construct).  The former coding was a
bit ad-hoc and inconsistent, and it missed some cases, as exposed by Mario
Weilguni's recent bug report.  His specific problem was that an IN could be
turned into a "clauseless" join due to constant-propagation removing the IN's
joinclause, and if the IN's subselect involved more than one relation and
there was more than one such IN linking to the same upper relation, then the
only valid join orders involve "bushy" plans but we would fail to consider the
specific paths needed to get there.  (See the example case added to the join
regression test.)  On examining the code I wonder if there weren't some other
problem cases too; in particular it seems that GEQO was defending against a
different set of corner cases than the main planner was.  There was also an
efficiency problem, in that when we did realize we needed a clauseless join
because of an IN, we'd consider clauseless joins against every other relation
whether this was sensible or not.  It seems a better design is to use the
outer-join and in-clause lists as a backup heuristic, just as the rule of
joining only where there are joinclauses is a heuristic: we'll join two
relations if they have a usable joinclause *or* this might be necessary to
satisfy an outer-join or IN-clause join order restriction.  I refactored the
code to have just one place considering this instead of three, and made sure
that it covered all the cases that any of them had been considering.

Backpatch as far as 8.1 (which has only the IN-clause form of the disease).
By rights 8.0 and 7.4 should have the bug too, but they accidentally fail
to fail, because the joininfo structure used in those releases preserves some
memory of there having once been a joinclause between the inner and outer
sides of an IN, and so it leads the code in the right direction anyway.
I'll be conservative and not touch them.
2007-02-16 00:14:01 +00:00
Alvaro Herrera 1820650934 Restructure autovacuum in two processes: a dummy process, which runs
continuously, and requests vacuum runs of "autovacuum workers" to postmaster.
The workers do the actual vacuum work.  This allows for future improvements,
like allowing multiple autovacuum jobs running in parallel.

For now, the code keeps the original behavior of having a single autovac
process at any time by sleeping until the previous worker has finished.
2007-02-15 23:23:23 +00:00
Tom Lane eecbb33267 Add ORDER BY to a query on information_schema.views, to avoid possible
platform-specific result ordering.  Per buildfarm results.
2007-02-15 05:05:03 +00:00
Tom Lane bfe553fb49 Repair oversight in 8.2 change that improved the handling of "pseudoconstant"
WHERE clauses.  createplan.c is now willing to stick a gating Result node
almost anywhere in the plan tree, and in particular one can wind up directly
underneath a MergeJoin node.  This means it had better be willing to handle
Mark/Restore.  Fortunately, that's trivial in such cases, since we can just
pass off the call to the input node (which the planner has previously ensured
can handle Mark/Restore).  Per report from Phil Frost.
2007-02-15 03:07:13 +00:00
Magnus Hagander d19da98a7f Make it possible to build with integer datetimes in msvc, and enable by default. 2007-02-14 21:02:07 +00:00
Bruce Momjian 764122471a Fix to_date()/to_timestamp() 'D' field for day of week, was off by one.
Converting from char using 'D' doesn't make lots of sense, of course.

Report from Brendan Jurd.
2007-02-14 05:10:55 +00:00
Bruce Momjian a9eb53969a Move fsync method macro defines into /include/access/xlogdefs.h so they
can be used by src/tools/fsync/test_fsync.c.
2007-02-14 05:00:40 +00:00
Neil Conway 595630af28 Fix capitalization and punctuation of two more GUC description strings. 2007-02-14 03:08:44 +00:00
Tom Lane 7bddca3450 Fix up foreign-key mechanism so that there is a sound semantic basis for the
equality checks it applies, instead of a random dependence on whatever
operators might be named "=".  The equality operators will now be selected
from the opfamily of the unique index that the FK constraint depends on to
enforce uniqueness of the referenced columns; therefore they are certain to be
consistent with that index's notion of equality.  Among other things this
should fix the problem noted awhile back that pg_dump may fail for foreign-key
constraints on user-defined types when the required operators aren't in the
search path.  This also means that the former warning condition about "foreign
key constraint will require costly sequential scans" is gone: if the
comparison condition isn't indexable then we'll reject the constraint
entirely. All per past discussions.

Along the way, make the RI triggers look into pg_constraint for their
information, instead of using pg_trigger.tgargs; and get rid of the always
error-prone fixed-size string buffers in ri_triggers.c in favor of building up
the RI queries in StringInfo buffers.

initdb forced due to columns added to pg_constraint and pg_trigger.
2007-02-14 01:58:58 +00:00
Tom Lane caf2b64a75 Disallow committing a prepared transaction unless we are in the same database
it was executed in.  Someday it might be nice to allow cross-DB commits, but
work would be needed in NOTIFY and perhaps other places.  Per Heikki.
2007-02-13 19:39:42 +00:00
Tom Lane cf4cc7843c Improve postmaster's behavior if an accept() call fails. Because the server
socket is still read-ready, the code was a tight loop, wasting lots of CPU.
We can't do anything to clear the failure, other than wait, but we should give
other processes more chance to finish and release FDs; so insert a small sleep.
Also, avoid bogus "close(-1)" in this case.  Per report from Jim Nasby.
2007-02-13 19:18:54 +00:00
Bruce Momjian d9db80f38d Add code so database scans are done in an order consistent with
pg_dumpall.
2007-02-13 18:06:18 +00:00
Bruce Momjian 3607cb0488 Add ORDER BY to vacummdb so databases are scaned in the same order as
pg_dumpall.
2007-02-13 17:39:39 +00:00
Magnus Hagander d2ad1a8e63 Un-break build on ANSI compilers (like msvc) by moving Assert to position
after variable declarations.
2007-02-13 15:56:12 +00:00
Magnus Hagander 43bcf568dc Add script to run regression tests under vc++ without mingw. Update
clean script to properly clean up the result of it.
2007-02-13 15:36:32 +00:00
Magnus Hagander 33692c104b One more fix for makefile := to : change. 2007-02-13 15:34:49 +00:00
Magnus Hagander cff7fcf173 Properly parse Makefile after change from := to =. 2007-02-13 15:01:52 +00:00
Tom Lane c17117649b Repair bug in 8.2's new logic for planning outer joins: we have to allow joins
that overlap an outer join's min_righthand but aren't fully contained in it,
to support joining within the RHS after having performed an outer join that
can commute with this one.  Aside from the direct fix in make_join_rel(),
fix has_join_restriction() and GEQO's desirable_join() to consider this
possibility.  Per report from Ian Harding.
2007-02-13 02:31:03 +00:00
Bruce Momjian 849b070707 Add comment to explain why O_EXCL and O_TRUNC can be ignored in
openFlagsToCreateFileFlags() in certain cases.
2007-02-13 02:06:22 +00:00