Commit Graph

5561 Commits

Author SHA1 Message Date
Tom Lane 3acf422316 Revise mechanism for getting rid of temp tables at backend shutdown.
Instead of grovelling through pg_class to find them, make use of the
handy dandy dependency mechanism: just delete everything that depends
on our temp schema.  Unlike the pg_class scan, the dependency mechanism
is smart enough to delete things in an order that doesn't fall foul of
any dependency restrictions.  Fixes problem reported by David Heggie:
a temp table with a serial column may cause a backend FATAL exit at
shutdown time, if it chances to try to delete the temp sequence first.
2003-02-07 01:33:06 +00:00
Tom Lane 00f1a41ab2 Make flatten_join_alias_vars() do the right thing when expanding an alias
referenced from a subquery.  Per example from Stefanos Harhalakis.
2003-02-06 22:21:11 +00:00
Tom Lane 77ede8900d Create a GUC variable REGEX_FLAVOR to control the type of regular
expression accepted by the regex operators, per discussion yesterday.

Along the way, reduce deadlock_timeout from PGC_POSTMASTER to PGC_SIGHUP
category.  It is probably best to insist that all backends share the same
setting, but that doesn't mean it has to be frozen at startup.
2003-02-06 20:25:33 +00:00
Tom Lane e24977f3a4 Allow qualified type names in CREATE CAST, DROP CAST. Also allow the
construction 'SETOF type[]' which for some reason was previously
overlooked (you'd have to name the array type directly to make it work).
2003-02-05 20:16:42 +00:00
Tom Lane 7bcc6d98fb Replace regular expression package with Henry Spencer's latest version
(extracted from Tcl 8.4.1 release, as Henry still hasn't got round to
making it a separate library).  This solves a performance problem for
multibyte, as well as upgrading our regexp support to match recent Tcl
and nearly match recent Perl.
2003-02-05 17:41:33 +00:00
Tom Lane 2d1f940542 Minor code cleanup: remove no-longer-useful pull_subplans() function,
and convert pull_agg_clause() into count_agg_clause(), which is a more
efficient way of doing what it's really being used for.
2003-02-04 00:50:01 +00:00
Tom Lane 85caf1784a Detect duplicate aggregate calls and evaluate only one copy. This
speeds up some useful real-world cases like
SELECT x, COUNT(*) FROM t GROUP BY x HAVING COUNT(*) > 100.
2003-02-04 00:48:23 +00:00
Tom Lane ef5842b5f7 #ifdef out stuff that shouldn't be compiled when not USE_SSL.
Curious that gcc doesn't complain about unreferenced static variables.
2003-02-03 22:33:51 +00:00
Tom Lane 3752e85bad Determine the set of constraints applied to a domain at executor
startup, not in the parser; this allows ALTER DOMAIN to work correctly
with domain constraint operations stored in rules.  Rod Taylor;
code review by Tom Lane.
2003-02-03 21:15:45 +00:00
Bruce Momjian 6b196c0754 Don't print NO ACTION foreign key actions in dumps and psql \d. 2003-02-03 15:17:24 +00:00
Tom Lane 4cff59d8d5 Tweak planner and executor to avoid doing ExecProject() in table scan
nodes where it's not really necessary.  In many cases where the scan node
is not the topmost plan node (eg, joins, aggregation), it's possible to
just return the table tuple directly instead of generating an intermediate
projection tuple.  In preliminary testing, this reduced the CPU time
needed for 'SELECT COUNT(*) FROM foo' by about 10%.
2003-02-03 15:07:08 +00:00
Bruce Momjian 0d3e36b668 Move pg_service.conf.sample to /interfaces/libpq. 2003-02-03 14:24:07 +00:00
Bruce Momjian 802a4d4111 Change MOVE LAST to MOVE ALL.
Standard says FETCH LAST is after last row, and we don't do that.
2003-02-03 14:04:24 +00:00
Tom Lane c7bceca156 Implement EXPLAIN EXECUTE. By Neil Conway, with some kibitzing from
Tom Lane.
2003-02-02 23:46:38 +00:00
Tom Lane 967e8a37ab Fix nodeUnique to behave correctly when reversing direction after reaching
either end of subplan results.  This prevents misbehavior of cursors
on SELECT DISTINCT ... queries.  Per bug report 1-Feb-02.
2003-02-02 19:08:57 +00:00
Tom Lane 6ba8af9d5d Remove restriction that cast functions cannot be volatile. This
restriction was debatable to begin with, but it has now become obvious
that it breaks forward-porting of user-defined types; contrib/lo being
the most salient example.
2003-02-01 22:09:26 +00:00
Tom Lane 21166170c8 Fix assign_session_authorization() to not be confused by all-numeric
user names.  Per recent reports.
2003-02-01 18:31:28 +00:00
Tom Lane 9d00798720 Tweak bison build rules so that we get the same error messages from
bison 1.875 and later as we did from earlier bison releases.  Eventually
we will probably want to adopt the newer message spelling ... but not yet.
Per recent discussion on pgpatches.
Note: I didn't change the build rules for bootstrap, ecpg, or plpgsql
grammars, since these do not affect regression test results.
2003-01-31 20:58:00 +00:00
Tom Lane bd96dd1184 Allow a time zone to be specified (and silently ignored) in the input
for type 'time without time zone', as we already did for type
'timestamp without time zone'.  This patch was proposed by Tom Lockhart
on 7-Nov-02, but he never got around to applying it.  Adjust regression
tests and documentation to match.
2003-01-31 01:08:08 +00:00
Tom Lane 26f56131ae SPI_exec shouldn't return SPI_OK_SELECT if it hasn't actually returned
a tuple table.  Fixes core dump in pltcl (and probably other PLs) when
executing a query rewritten by a rule.  Per bug report from Wolfgang Walter.
2003-01-29 15:24:46 +00:00
Tom Lane 5fdb142f16 Tweak ArrayCount() to forestall possible access to temp[-1]. Problem
cannot actually happen at present because ArrayCount() is only called
on strings beginning with '{', but seems best to prevent it going forward.
Per report from Yichen Xie.
2003-01-29 01:28:33 +00:00
Tom Lane 23b8a0ce61 Repair array subscript overrun identified by Yichen Xie. Reduce the
value of MAX_TIME_PRECISION in floating-point-timestamp-storage case
from 13 to 10, which is as much as time_out is actually willing to print.
(The alternative of increasing the number of digits we are willing to
print looks risky; we might find ourselves printing roundoff garbage.)
2003-01-29 01:08:42 +00:00
Tom Lane b8add56ed0 Fix array subscript overruns identified by Yichen Xie. 2003-01-29 01:01:05 +00:00
Tom Lane 2e46b762eb Extend join-selectivity API (oprjoin interface) so that join type is
passed to join selectivity estimators.  Make use of this in eqjoinsel
to derive non-bogus selectivity for IN clauses.  Further tweaking of
cost estimation for IN.
initdb forced because of pg_proc.h changes.
2003-01-28 22:13:41 +00:00
Tom Lane c0276244b1 Convert variable name to canonical spelling before checking for matches
in GUCArrayAdd/GUCArrayDelete.  This prevents the multiple-entry bug
exhibited by Frank Lupo 28-Jan-2003.
2003-01-28 18:04:02 +00:00
Bruce Momjian 7af352d091 Revert off setting mention for client_min_messages.
Set log_min_error_messages to the proper and agreed-upon default, PANIC
(off).  (BACKPATCH)
2003-01-28 03:43:47 +00:00
Bruce Momjian f21fb30dfc Revert optimizer page count change. 2003-01-28 03:34:29 +00:00
Bruce Momjian bd175cc9fb Set log_min_error_messages to the proper and agreed-upon default, PANIC (off).
Backpatch to 7.3.X.
2003-01-27 23:55:38 +00:00
Tom Lane 70fba70430 Upgrade cost estimation for joins, per discussion with Bradley Baetz.
Try to model the effect of rescanning input tuples in mergejoins;
account for JOIN_IN short-circuiting where appropriate.  Also, recognize
that mergejoin and hashjoin clauses may now be more than single operator
calls, so we have to charge appropriate execution costs.
2003-01-27 20:51:54 +00:00
Tom Lane 33875872fd Get rid of last few unadorned 'permission denied' messages. 2003-01-27 00:51:06 +00:00
Bruce Momjian dc87ea755c Include IPv6 addresses in pg_hba.conf even if IPv6 is not supported; at
suggestion of Peter.
2003-01-26 01:19:22 +00:00
Tom Lane 9f5f212475 Allow the planner to collapse explicit inner JOINs together, rather than
necessarily following the JOIN syntax to develop the query plan.  The old
behavior is still available by setting GUC variable JOIN_COLLAPSE_LIMIT
to 1.  Also create a GUC variable FROM_COLLAPSE_LIMIT to control the
similar decision about when to collapse sub-SELECT lists into their parent
lists.  (This behavior existed already, but the limit was always
GEQO_THRESHOLD/2; now it's separately adjustable.)
2003-01-25 23:10:30 +00:00
Tom Lane 15ab7a8720 Where available, use utime() or utimes() to update the file mod time
of the socket file and socket lock file; this should prevent both of them
from being removed by even the stupidest varieties of /tmp-cleaning
script.  Per suggestion from Giles Lean.
2003-01-25 05:19:47 +00:00
Tom Lane 80727ce14f Use stat(2) to probe for existing xlog segments in InstallXLogFileSegment,
rather than actually opening the files.  This eliminates some corner cases
where the file indeed exists but open() fails for another reason, such
as being out of file descriptors.  The net reliability gain is probably
tiny, since xlog.c is full of other file open calls that will elog(PANIC)
if they fail for any reason; but this specific failure mode has been
observed in the field, so we may as well fix it.
2003-01-25 03:06:04 +00:00
Tom Lane 7a196bab23 Suppress gcc warnings. 2003-01-24 21:53:29 +00:00
Tom Lane f5e83662d0 Modify planner's implied-equality-deduction code so that when a set
of known-equal expressions includes any constant expressions (including
Params from outer queries), we actively suppress any 'var = var'
clauses that are or could be deduced from the set, generating only the
deducible 'var = const' clauses instead.  The idea here is to push down
the restrictions implied by the equality set to base relations whenever
possible.  Once we have applied the 'var = const' clauses, the 'var = var'
clauses are redundant, and should be suppressed both to save work at
execution and to avoid double-counting restrictivity.
2003-01-24 03:58:44 +00:00
Peter Eisentraut ef7422510e Grant options, and cascading revoke. Grant options are allowed only for
users right now, not groups.  Extension of has_foo_privileges functions to
query the grant options.  Extension of aclitem type to store grantor.
2003-01-23 23:39:07 +00:00
Tom Lane 36777c1e35 Fix obsolete error message (isImmutable doesn't exist). 2003-01-23 15:18:40 +00:00
Tom Lane 790d5bc992 Change CREATE TABLE AS / SELECT INTO to create the new table with OIDs,
for backwards compatibility with pre-7.3 behavior.  Per discussion on
pgsql-general and pgsql-hackers.
2003-01-23 05:10:41 +00:00
Tom Lane b3d7af46a9 Fix sloppy comment. 2003-01-22 20:44:20 +00:00
Tom Lane c4d0ff32e9 Make estimation of mergejoin scan selectivities more robust, per recent
example from RaÇl GutiÅrrez.
2003-01-22 20:16:42 +00:00
Tom Lane c7b4047234 Improve print_expr() a little. It's still not very bright though. 2003-01-22 19:26:35 +00:00
Tom Lane e2114817c7 Implement choice between hash-based and sort-based grouping for doing
DISTINCT processing on the output of an IN sub-select.
2003-01-22 00:07:00 +00:00
Tom Lane a4482f4c4c Fix coredump problem in plpgsql's RETURN NEXT. When a SELECT INTO
that's selecting into a RECORD variable returns zero rows, make it
assign an all-nulls row to the RECORD; this is consistent with what
happens when the SELECT INTO target is not a RECORD.  In support of
this, tweak the SPI code so that a valid tuple descriptor is returned
even when a SPI select returns no rows.
2003-01-21 22:06:12 +00:00
Tom Lane 1a7c6ee8c6 Avoid gratuitous variation in spelling of same error message. 2003-01-21 19:44:26 +00:00
Tom Lane bdfbfde1b1 IN clauses appearing at top level of WHERE can now be handled as joins.
There are two implementation techniques: the executor understands a new
JOIN_IN jointype, which emits at most one matching row per left-hand row,
or the result of the IN's sub-select can be fed through a DISTINCT filter
and then joined as an ordinary relation.
Along the way, some minor code cleanup in the optimizer; notably, break
out most of the jointree-rearrangement preprocessing in planner.c and
put it in a new file prep/prepjointree.c.
2003-01-20 18:55:07 +00:00
Tom Lane b19adc1aae Fix parse_agg.c to detect ungrouped Vars in sub-SELECTs; remove code
that used to do it in planner.  That was an ancient kluge that was
never satisfactory; errors should be detected at parse time when possible.
But at the time we didn't have the support mechanism (expression_tree_walker
et al) to make it convenient to do in the parser.
2003-01-17 03:25:04 +00:00
Tom Lane a4d82dd4b4 Adjust API of expression_tree_mutator and query_tree_mutator to
simplify callers.  It turns out the common case is that the caller
does want to recurse into sub-queries, so push support for that into
these subroutines.
2003-01-17 02:01:21 +00:00
Tom Lane 227a404cf4 Add code to print information about a detected deadlock cycle. The
printed data is comparable to what you could read in the pg_locks view,
were you fortunate enough to have been looking at it at the right time.
2003-01-16 21:01:45 +00:00
Tom Lane 136828c699 Ooops, didn't cut-and-paste quite enough code from ResolveNew;
with result that flatten_join_alias_vars failed to descend into subselects.
2003-01-16 18:26:02 +00:00