Commit Graph

12306 Commits

Author SHA1 Message Date
Neil Conway afca5d50dc Cleanup: move the 'Value' node into a separate file, rather than putting
it in the same file as the 'List' node.
2004-01-07 18:43:36 +00:00
Tom Lane 304d6d5b63 Support function parameter names in plpgsql. This is the last of
Dennis Bjorklund's original patch for function parameter names, but
there's still plenty left to do (documentation for instance...)
2004-01-07 06:20:02 +00:00
Tom Lane 6400d69d87 pg_dump support for function parameter names. 2004-01-07 00:44:21 +00:00
Tom Lane a77e32d7c5 Apply the core parts of Dennis Bjorklund's patch to allow function
parameters to be declared with names.  pg_proc has a column to store
names, and CREATE FUNCTION can insert data into it, but that's all as
yet.  I need to do more work on the pg_dump and plpgsql portions of the
patch before committing those, but I thought I'd get the bulky changes
in before the tree drifts under me.
initdb forced due to pg_proc change.
2004-01-06 23:55:19 +00:00
Bruce Momjian 488f2785d0 Final rearrangement of main postgresql child process (ie.
BackendFork/SSDataBase/pgstat) startup, to allow fork/exec calls to
closely mimic (the soon to be provided) Win32 CreateProcess equivalent
calls.

Claudio Natoli
2004-01-06 23:15:22 +00:00
Tom Lane 06288d4e22 Suppress compiler warning (xlog_outrec is unused if not WAL_DEBUG). 2004-01-06 22:22:37 +00:00
Neil Conway dfc7e7b71d Code cleanup, mostly in the smgr:
- Update comment in IsReservedName() to the present day

     - Improve some variable & function names in commands/vacuum.c. I
       was planning to rewrite this to avoid lappend(), but since I
       still intend to do the list rewrite, there's no need for that.

     - Update some smgr comments which seemed to imply that we still
       forced all dirty pages to disk at commit-time.

     - Replace some #ifdef DIAGNOSTIC code with assertions.

     - Make the distinction between OS-level file descriptors and
       virtual file descriptors a little clearer in a few comments

     - Other minor comment improvements in the smgr code
2004-01-06 18:07:32 +00:00
Neil Conway 030f8e7313 Remove unused 'noversion' command-line option processing from the
backend.
2004-01-06 17:36:31 +00:00
Neil Conway bc028beb16 Make the 'wal_debug' GUC variable a boolean (rather than an integer), and
hide it behind #ifdef WAL_DEBUG blocks.
2004-01-06 17:26:23 +00:00
Tom Lane b0c4a50bbb Instead of rechecking lossy index operators by putting them into the
regular qpqual ('filter condition'), add special-purpose code to
nodeIndexscan.c to recheck them.  This ends being almost no net addition
of code, because the removal of planner code balances out the extra
executor code, but it is significantly more efficient when a lossy
operator is involved in an OR indexscan.  The old implementation had
to recheck the entire indexqual in such cases.
2004-01-06 04:31:01 +00:00
Tom Lane fa559a86ee Adjust indexscan planning logic to keep RestrictInfo nodes associated
with index qual clauses in the Path representation.  This saves a little
work during createplan and (probably more importantly) allows reuse of
cached selectivity estimates during indexscan planning.  Also fix latent
bug: wrong plan would have been generated for a 'special operator' used
in a nestloop-inner-indexscan join qual, because the special operator
would not have gotten into the list of quals to recheck.  This bug is
only latent because at present the special-operator code could never
trigger on a join qual, but sooner or later someone will want to do it.
2004-01-05 23:39:54 +00:00
Neil Conway 5d472f6464 Trivial refactoring: move analysis of ViewStmt into its own function for
readability and for the sake of consistency with the rest of analyze.c
2004-01-05 20:58:58 +00:00
Neil Conway 548523533f Fix three trivial typos in comments. 2004-01-05 20:36:04 +00:00
Peter Eisentraut 35b1fe122c Translation updates 2004-01-05 19:15:48 +00:00
Tom Lane 5c74ce23db Improve UniquePath logic to detect the case where the input is already
known unique (eg, it is a SELECT DISTINCT ... subquery), and not do a
redundant unique-ification step.
2004-01-05 18:04:39 +00:00
Tom Lane cce442da6d Dept. of second thoughts: clause_selectivity shouldn't try to cache its
result for jointypes associated with IN processing.
2004-01-05 16:44:40 +00:00
Tom Lane 9091e8d1b2 Add the ability to extract OR indexscan conditions from OR-of-AND
join conditions in which each OR subclause includes a constraint on
the same relation.  This implements the other useful side-effect of
conversion to CNF format, without its unpleasant side-effects.  As
per pghackers discussion of a few weeks ago.
2004-01-05 05:07:36 +00:00
Michael Meskes 40417169ba Fixed bug in GRANT OPTION FOR parsing. 2004-01-04 14:49:06 +00:00
Tom Lane 187b190adb There's no longer any good reason for genbki.sh and Gen_fmgrtab.sh to
run the data through cpp, and we know of at least one platform where
unusual cpp behavior breaks the process.  So remove the cpp step,
and make consequent simplifications.
2004-01-04 05:57:21 +00:00
Tom Lane 4351f8823d Fix portability bugs: char values passed to <ctype.h> functions must
be cast to unsigned char.  We have learned this the hard way before.
2004-01-04 04:17:01 +00:00
Tom Lane 558ed5aee1 Fix discrepancy in prototypes for HPUX pg_dlerror. 2004-01-04 04:06:37 +00:00
Tom Lane 9a4ef0c562 Fix ReadOffset() to work correctly when off_t is wider than int. 2004-01-04 04:02:15 +00:00
Tom Lane 82b4dd394f Merge restrictlist_selectivity into clauselist_selectivity by
teaching the latter to accept either RestrictInfo nodes or bare
clause expressions; and cache the selectivity result in the RestrictInfo
node when possible.  This extends the caching behavior of approx_selectivity
to many more contexts, and should reduce duplicate selectivity
calculations.
2004-01-04 03:51:52 +00:00
Bruce Momjian 21a1202281 Remove trailing newline from file. 2004-01-04 00:50:11 +00:00
Bruce Momjian f04af68e54 Remove trailing semicolons from macro initializations in plpython.
Problem report on True64 Unix by Nikola Milutinovic.
2004-01-04 00:14:17 +00:00
Bruce Momjian e3107b2844 Mention grabbing typedefs from pgsql/lib too. 2004-01-04 00:11:29 +00:00
Tom Lane 6cb1c0238b Rewrite OR indexscan processing to be more flexible. We can now for the
first time generate an OR indexscan for a two-column index when the WHERE
condition is like 'col1 = foo AND (col2 = bar OR col2 = baz)' --- before,
the OR had to be on the first column of the index or we'd not notice the
possibility of using it.  Some progress towards extracting OR indexscans
from subclauses of an OR that references multiple relations, too, although
this code is #ifdef'd out because it needs more work.
2004-01-04 00:07:32 +00:00
Tom Lane 037e2fcf8f Must test for __hppa__ as well as __hppa to make linux-hppa happy. 2004-01-03 05:47:44 +00:00
Tom Lane b3c3b5464d Do an explicit fflush after writing a progress message with puts.
This ensures stdout is kept in sync with messages on stderr.
Per report from Olaf Ferger.
2004-01-01 19:27:15 +00:00
Bruce Momjian 8042c79fd1 Make Solaris non-gcc thread flag "-mt" a compile flag, not a link flag. 2003-12-31 16:14:44 +00:00
Tom Lane be6c38b903 Adjust the definition of RestrictInfo's left_relids and right_relids
fields: now they are valid whenever the clause is a binary opclause,
not only when it is a potential join clause (there is a new boolean
field canjoin to signal the latter condition).  This lets us avoid
recomputing the relid sets over and over while examining indexes.
Still more work to do to make this as useful as it could be, because
there are places that could use the info but don't have access to the
RestrictInfo node.
2003-12-30 23:53:15 +00:00
Bruce Momjian cf4d324d02 Add "-mt" link flag for Solaris non-gcc compiles when using threads ---
required.
2003-12-30 23:13:51 +00:00
Tom Lane 9888192fb7 Instead of trying to force WHERE clauses into CNF or DNF normal form,
just look for common clauses that can be pulled out of ORs.  Per recent
discussion, extracting common clauses seems to be the only really useful
effect of normalization, and if we do it explicitly then we can avoid
cluttering the qual with partially-redundant duplicated expressions, which
was an unpleasant side-effect of the old approach.
2003-12-30 21:49:19 +00:00
Tom Lane 7af16b2a25 Avoid running out of memory during hash_create, by not passing a
number-of-buckets that exceeds the size we actually plan to allow
the hash table to grow to.  Per trouble report from Sean Shanny.
2003-12-30 20:05:05 +00:00
Tom Lane e8aa10ee47 ShmemInitHash forgot to specify HASH_ALLOC flag bit in its hash_create
call.  You'd think this would cause some problems, but because of the
way hash_create is coded, the only side-effect was creation of a useless
memory context for the hashtable.
2003-12-30 00:03:03 +00:00
Tom Lane ea43da5138 Use hash table name, not one-size-fits-all 'DynaHashTable', to identify
memory contexts belonging to hash tables.  Makes the memory stats printout
a little more useful.
2003-12-29 23:54:22 +00:00
Tom Lane 5c5b911fcc Using canonicalize_qual() to get rid of duplicate index predicate
conditions is overkill; set_union() does the job about as well, and
much more efficiently.  Furthermore this avoids assuming that
canonicalize_qual() will check for duplicate clauses at all, which
it may not always do.
2003-12-29 22:22:45 +00:00
Tom Lane b53ca9bbcb Improve comment. 2003-12-29 21:44:49 +00:00
Tom Lane 07f9f4d413 Tweak OpernameGetCandidates() to reduce palloc overhead --- profiling
showed that for common operator names such as '=', the pallocs done by
this routine occupied a surprisingly large fraction of the total time
for the parser to process an operator.
2003-12-29 21:33:09 +00:00
Michael Meskes 21b3c0e0ec Added missing whitespaces to array argument parsing. 2003-12-29 13:53:04 +00:00
Tom Lane c607bd693f Clean up the usage of canonicalize_qual(): in particular, be consistent
about whether it is applied before or after eval_const_expressions().
I believe there were some corner cases where the system would fail to
recognize that a partial index is applicable because of the previous
inconsistency.  Store normal rather than 'implicit AND' representations
of constraints and index predicates in the catalogs.
initdb forced due to representation change of constraints/predicates.
2003-12-28 21:57:37 +00:00
Tom Lane d167fb1015 Fix sanity-check code that mistakenly assumed error and notice messages
could never exceed 30K.  Per report from Andreas Pflug.
2003-12-28 17:43:57 +00:00
Tom Lane 36c9a01acf Avoid infinite loop if connection is lost during PQexecStart() or
PQexecFinish().  Per report from Andreas Pflug.
2003-12-28 17:29:41 +00:00
Tom Lane f8eed65dfb Improve spinlock code for recent x86 processors: insert a PAUSE
instruction in the s_lock() wait loop, and use test before test-and-set
in TAS() macro to avoid unnecessary bus traffic.  Patch from Manfred
Spraul, reworked a bit by Tom.
2003-12-27 20:58:58 +00:00
Bruce Momjian aeddc2a60d Continued rearrangement to permit pgstat + BootstrapMain processes to be
fork/exec'd, in the same mode as the previous patch for backends.

Claudio Natoli
2003-12-25 03:52:51 +00:00
Bruce Momjian 3e32e9476f Patch that makes quoting "sameuser", "samegroup", and "all" remove
special meaning of these terms in pg_hba.conf.

Also changes ugly pg_hba.conf IPv6 netmask of
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff to ::1/128.

Andrew Dunstan
2003-12-25 03:44:05 +00:00
Bruce Momjian 1c757c49fa > > I have no idea if this in Oracle or not. But it's something I
> > needed, and other people in the past asked about it too.
>
> It is in Oracle, but you aren't exactly on the spot.  It should be
>
> IYYY - 4 digits  ('2003')
> IYY  - 3 digits  ('003')
> IY   - 2 digits  ('03')
> I    - 1 digit   ('3')

Here is an updated patch that does that.

Kurt Roeckx
2003-12-25 03:36:24 +00:00
Michael Meskes 03caf7649b Fixed segfault in parsing of EXEC SQL SELECT * FROM foo() AS TBL( c int, i int); 2003-12-24 22:04:09 +00:00
Bruce Momjian a922472a2a Supress non-temp schemas from psql \dn display. 2003-12-23 23:13:14 +00:00
Tom Lane afb09b5a31 Use inlined TAS() on PA-RISC, if we are compiling with gcc.
Patch inspired by original submission from ViSolve.
2003-12-23 22:15:07 +00:00
Tom Lane cd2ad9b944 Fix a number of places where reconfiguring with a different installation
prefix would fail, because the new path did not get propagated to where
it needed to be.  Note this would fail even with --enable-depend.
2003-12-23 21:56:21 +00:00
Tom Lane 358d032f98 Fix compile warning. 2003-12-23 21:50:38 +00:00
Tom Lane 2fb67fa469 More bogosity in alter_table test: sometimes causes prepare test to fail
by means of arbitrarily renaming tables the other test depends on.
2003-12-23 20:34:45 +00:00
Tom Lane e8a4515626 alter_table test sometimes failed in parallel mode, because of transient
table name conflict against rangefuncs test.
2003-12-23 20:17:47 +00:00
Tom Lane baee5f75c5 Push responsibility for selecting out-of-line-assembler TAS code out to
the platform template files, instead of doing it directly in configure.in.
This seems cleaner, and also opens the door to making the choice be
dependent on the compiler being used.
2003-12-23 18:40:53 +00:00
Tom Lane 9adaf64da3 Mop-up for HAS_TEST_AND_SET refactoring. Un-break two or three platforms
that were broken, try to make layout of s_lock.h entries consistent,
use HAVE_SPINLOCKS in preference to HAS_TEST_AND_SET everywhere outside
s_lock.h itself.
2003-12-23 18:13:17 +00:00
Bruce Momjian caf6e9d2dd Have configure --without-spinlocks actually not use spinlock code, even
if supported by the cpu.
2003-12-23 03:52:10 +00:00
Bruce Momjian 69f2e9b0fc Move slock_t typdefs into s_lock.h from include/port files for
centralization and easier maintanence.
2003-12-23 03:31:30 +00:00
Bruce Momjian dcae5781d1 Remove __alpha__ additions in main.c but document that they are missing. 2003-12-23 00:34:04 +00:00
Bruce Momjian 887b5a7be0 Remove NEED_I386_TAS_ASM and just test for compiler defines. 2003-12-23 00:32:06 +00:00
Tom Lane f66b0ff066 Allow plpgsql variables' default value expressions to reference
existing variables (such as function parameters).  Per gripe from
David Fetter.
2003-12-23 00:01:57 +00:00
Bruce Momjian 9114cb1c5f This applied patch remove NEED_SPARC_TAS_ASM and instead uses __sparc ||
__sparc__.
2003-12-22 23:39:53 +00:00
Bruce Momjian b731d04101 Test for __alpha and __alpha__. 2003-12-22 23:36:38 +00:00
Tom Lane ef92b82dbb Further cleanup in _bt_first: eliminate duplicate code paths. 2003-12-21 17:52:34 +00:00
Bruce Momjian 0ea4f9c859 Back out:
>  Attached is a patch that addressed all the discussed issues
>  that did not break backward compatability, including the
>  ability to output ISO-8601 compliant intervals by setting
>  datestyle to iso8601basic.
2003-12-21 04:34:36 +00:00
Bruce Momjian ced30eb857 [ This description should have been on the earlier fork/exec
commit, but I am adding it now so it is in CVS.]

The patch basically is a slight rearrangement of the code to allow
fork/exec on Unix, with the ultimate goal of doing CreateProcess on
Win32.  The changes are:

        o  Write out postmaster global variables and per-backend
variables to be read by the exec'ed backend

        o  Mark some static variables as global when exec is used so
then can be dumped from postmaster.c, marked NON_EXEC_STATIC

        o  Remove value passing with -p now that we have per-backend
file

        o  Move some pointer storage out of shared memory for easier
dumping.

        o  Modified pgsql_temp directory cleanup to handle per-database
directories and the backend exec directory under datadir.


Claudio Natoli
2003-12-21 04:30:10 +00:00
Tom Lane 2a0caefeb5 Previous change exposed some opportunities for further simplification
in _bt_first().
2003-12-21 03:00:04 +00:00
Tom Lane 569659ae16 Improve btree's initial-positioning-strategy code so that we never need
to step more than one entry after descending the search tree to arrive at
the correct place to start the scan.  This can improve the behavior
substantially when there are many entries equal to the chosen boundary
value.  Per suggestion from Dmitry Tkach, 14-Jul-03.
2003-12-21 01:23:06 +00:00
Tom Lane 772d0f9345 The recent DUMMY_PROCS patch broke accounting for the number of semaphores
needed.  This caused us to fail all the time on Darwin, and we'd fail for
some values of maxBackends on SysV-sema platforms, too.
2003-12-21 00:33:33 +00:00
Tom Lane 16cc9dff4f bufmgr.c failed to compile on Darwin, because it didn't include
<sys/time.h> where struct timeval is defined.
2003-12-20 22:18:02 +00:00
Tom Lane fb8ac3fcb6 Dept. of third thoughts: in fact, libpq should support SCM_CREDS challenge
even when HAVE_GETPEEREID is defined, else it will be unable to connect to
pre-7.4 backends that are using IDENT authentication.
2003-12-20 18:45:49 +00:00
Tom Lane b8f2980209 Fix broken IDENT support for FreeBSD (appears to have been broken by
ill-considered conditional logic in getpeereid patch of 3-Dec-2002).
Per bug #1021.
2003-12-20 18:24:52 +00:00
Bruce Momjian d75b2ec4eb This patch is the next step towards (re)allowing fork/exec.
Claudio Natoli
2003-12-20 17:31:21 +00:00
Bruce Momjian 54c8e821b8 In my mind there were two categories of open issues
a) ones that are 100% backward (such as the comment about
     outputting this format)
and
  b) ones that aren't (such as deprecating the current
     postgresql shorthand of
         '1Y1M'::interval = 1 year 1 minute
     in favor of the ISO-8601
         'P1Y1M'::interval = 1 year 1 month.

Attached is a patch that addressed all the discussed issues that
did not break backward compatability, including the ability to
output ISO-8601 compliant intervals by setting datestyle to
iso8601basic.

Interval values can now be written as  ISO 8601 time intervals, using
the "Format with time-unit designators". This format always starts with
the character 'P', followed  by a string of values followed
by single character time-unit designators. A 'T' separates the date and
time parts of the interval.

Ron Mayer
2003-12-20 15:32:55 +00:00
Bruce Momjian 85f51dea1c Supress ecpg thread test if configure didn't enable threads. Fix
tools/thread to run even if configure didn't enable threads because this
test is used before enabling threads for the OS.
2003-12-19 23:29:15 +00:00
Bruce Momjian 580cae7567 Prevent service dbname from defaulting to service name, per bug report
from Michael Fuhr
2003-12-19 21:50:54 +00:00
Peter Eisentraut f39748a70f Forbid REVOKE on untrusted languages, and don't dump privileges of
untrusted languages (in case they sneak in).
2003-12-19 14:21:56 +00:00
Peter Eisentraut 9a1cab4391 Add missing $(X). 2003-12-19 11:54:25 +00:00
Tom Lane 7fc2d50877 Make to_hex() behave portably on negative input values (treat them as
unsigned integers).  Per report from Jim Crate.
2003-12-19 04:56:41 +00:00
Joe Conway edc7f146e3 Use a shutdown callback to ensure proper clean up when rescanning
partially-evaluated SRFs. Per report found here:
http://archives.postgresql.org/pgsql-general/2003-12/msg00851.php
2003-12-19 00:02:11 +00:00
Tom Lane e0cd175212 Fix memory leak with SSL connections due to missing X509_free() calls.
Per Neil Conway.
2003-12-18 22:49:26 +00:00
Tom Lane 54840eca2e Use a shutdown callback to clear setArgsValid in a FuncExprState that is
evaluating a set-valued function.  This fixes some additional problems
with rescanning partially-evaluated SRFs.
2003-12-18 22:23:42 +00:00
Peter Eisentraut ed8e5143c2 Forgot to change one compatlib.h. 2003-12-18 20:25:58 +00:00
Tom Lane 38423232a5 Ensure set-returning functions in the targetlist of a plan node will be
shut down cleanly if the plan node is ReScanned before the SRFs are run
to completion.  This fixes the problem for SQL-language functions, but
still need work on functions using the SRF_XXX() macros.
2003-12-18 20:21:37 +00:00
Peter Eisentraut ad8c09c29c Move Informix compatibility include files out of the way. compatlib.h
was integrated into ecpg_informix.h, the other ones go into their own
subdirectory that is automatically considered by the embedded preprocessor
when in Informix mode.
2003-12-18 18:55:09 +00:00
Dave Cramer b4ed1edb57 patch for new OID74Test 2003-12-18 04:17:17 +00:00
Dave Cramer b9deede241 fixed up OID74 test to conform with other tests, by Kris Jurka 2003-12-18 04:08:30 +00:00
Bruce Momjian ed96bfde18 Here is the definition of relation_byte_size() in optimizer/path/costsize.c:
----------------------------------------------------------------------
/*
 * relation_byte_size
 *        Estimate the storage space in bytes for a given number of tuples
 *        of a given width (size in bytes).
 */
static double
relation_byte_size(double tuples, int width)
{
        return tuples * (MAXALIGN(width) + MAXALIGN(sizeof(HeapTupleData)));
}

----------------------------------------------------------------------

Shouldn't this be HeapTupleHeaderData and not HeapTupleData ?

(Of course, from a costing perspective these shouldn't be very different but ...)

Sailesh Krishnamurthy
2003-12-18 03:46:45 +00:00
Dave Cramer bb58eed004 patch by Kris Jurka to use the correct protocol based upon server information 2003-12-18 03:27:15 +00:00
Tom Lane 38b0dff0d3 Adjust rules output for unknown-vs-any change (affects expected contents
of pg_stats view definition).
2003-12-18 01:48:53 +00:00
Tom Lane 109a4a603f Be a little smarter in group_clauses_by_indexkey_for_join: detect cases
where a joinclause is redundant with a restriction clause.  Original coding
believed this was impossible and didn't need to be checked for, but that
was a thinko ...
2003-12-18 00:22:12 +00:00
Tom Lane 422249120d information_schema.constraint_column_usage and key_column_usage should
not discriminate against system columns, since we support constraints on
system columns, and in fact constraints on OID are moderately useful.
2003-12-17 22:11:30 +00:00
Tom Lane 78f637c6da Fix DecodeInterval to handle '-0.1' sanely, per gripe from Tilo Schwarz. 2003-12-17 21:45:44 +00:00
Tom Lane f758097c6d Reorder tests in parse_coerce so that ANY/ANYELEMENT/ANYARRAY coercion
does not affect UNKNOWN-type literals or Params.  This fixes the recent
complaint about count('x') being broken, and improves consistency in
a few other respects too.
2003-12-17 19:49:39 +00:00
Peter Eisentraut b40b3306fa Remove pg_id. 2003-12-17 18:44:09 +00:00
Tom Lane 99e922a01d Repair planner failure when there are multiple IN clauses, each with
a join in its subselect.  In this situation we *must* build a bushy
plan because there are no valid left-sided or right-sided join trees.
Accordingly, hoary sanity check needs an update.  Per report from
Alessandro Depase.
2003-12-17 17:07:48 +00:00
Dave Cramer 9dddd242dd revoked patch from Kris Jurka to fix multiarguments, and changed test to create
a temp table
2003-12-17 15:45:05 +00:00
Dave Cramer e4955c2ec3 patch from Kris Jurka to fix large object 7.1 compatible protocol issues
modified test case from Alexey Yudichev to be part of the testsuite
2003-12-17 15:38:42 +00:00
Michael Meskes 95eea2d89c - Added just another patch by Dave that fixes a reversed order in
variable listing for output variables in cursor definitions
- Fixed incorrect if call in long=>numeric conversion.
2003-12-17 15:23:45 +00:00
Dave Cramer 845109e606 added polish translation submitted by Piotr Maj 2003-12-17 13:25:14 +00:00