Commit Graph

15605 Commits

Author SHA1 Message Date
Bruce Momjian af00c04c42 Fix psql history handling:
> 1) Fix the problems with the \s command.
> When the saveHistory is executed by the \s command we must not do the
> conversion \n -> \x01  (per
> http://archives.postgresql.org/pgsql-hackers/2006-03/msg00317.php )
>
> 2) Fix the handling of Ctrl+C
>
> Now when you do
> wsdb=# select 'your long query here '
> wsdb-#
> and press afterwards the CtrlC the line "select 'your long query here
'"
> will be in the history
>
> (partly per
> http://archives.postgresql.org/pgsql-hackers/2006-03/msg00297.php )
>
> 3) Fix the handling of commands with not closed brackets, quotes,
double
> quotes. (now those commands are not splitted in parts...)
>
> 4) Fix the behaviour when SINGLELINE mode is used. (before it was
almost
> broken ;(

Sergey E. Koposov
2006-03-21 13:38:12 +00:00
Bruce Momjian 3b7e2b140e Update comment that pgNotify.be_pid is pid of the notifying server process. 2006-03-20 15:07:05 +00:00
Neil Conway a323ede280 Fix a few places that were checking for the return value of palloc() to be
non-NULL: palloc() ereports on OOM, so we can safely assume it returns a
valid pointer.
2006-03-19 22:22:56 +00:00
Tom Lane 381cb046ed Adjust join_1.out to match Windows behavior for new mergejoin regression
test, per Dave Page and buildfarm.  Perhaps we will need a join_2 instead,
but for the moment assume that this test tracks the other diffs.
2006-03-19 01:19:42 +00:00
Neil Conway a5dba02359 The call to DNSServiceRegistrationCreate in postmaster.c does incorrect
byte-swapping on the port number which causes the call to fail on Intel
Macs.

This patch uses htons() instead of htonl() and fixes this bug.

Ashley Clark
2006-03-18 22:09:58 +00:00
Tom Lane b3358e2642 Fix bug introduced into mergejoin logic by performance improvement patch of
2005-05-13.  When we find that a new inner tuple can't possibly match any
outer tuple (because it contains a NULL), we can't immediately skip the
tuple when we are in NEXTINNER state.  Doing so can lead to emitting
multiple copies of the tuple in FillInner mode, because we may rescan the
tuple after returning to a previous marked tuple.  Instead, proceed to
NEXTOUTER state the same as we used to do.  After we've found that there's
no need to return to the marked position, we can go to SKIPINNER_ADVANCE
state instead of SKIP_TEST when the inner tuple is unmatchable; this
preserves the performance improvement.  Per bug report from Bruce.
I also made a couple of cosmetic code rearrangements and added a regression
test for the problem.
2006-03-17 19:38:12 +00:00
Michael Meskes 0941a8901b Fixed bug 2330: Wrong error code in case of a duplicate key 2006-03-17 15:46:13 +00:00
Tom Lane 92f5bfcc0f Fix invalid use of #if within a macro, per Laurenz Albe. Also try to
make the LDAP code's error messages look like they were written by someone
who had heard of our style guidelines.
2006-03-16 18:11:17 +00:00
Tom Lane 2316013961 Clean up representation of function RTEs for functions returning RECORD.
The original coding stored the raw parser output (ColumnDef and TypeName
nodes) which was ugly, bulky, and wrong because it failed to create any
dependency on the referenced datatype --- and in fact would not track type
renamings and suchlike.  Instead store a list of column type OIDs in the
RTE.

Also fix up general failure of recordDependencyOnExpr to do anything sane
about recording dependencies on datatypes.  While there are many cases where
there will be an indirect dependency (eg if an operator returns a datatype,
the dependency on the operator is enough), we do have to record the datatype
as a separate dependency in examples like CoerceToDomain.

initdb forced because of change of stored rules.
2006-03-16 00:31:55 +00:00
Bruce Momjian 5981b9d03e Fix typo in pgcvslog, used == instead of =. 2006-03-15 03:24:17 +00:00
Tom Lane 1349839c3c It seems the YYLLOC_DEFAULT macro recommended by the Bison 1.875 manual
just doesn't work with Bison 2.0 ... fix it ...
2006-03-14 23:03:20 +00:00
Tom Lane 35b5509782 Missed this file in previous commit :-( 2006-03-14 22:50:46 +00:00
Tom Lane 20ab467d76 Improve parser so that we can show an error cursor position for errors
during parse analysis, not only errors detected in the flex/bison stages.
This is per my earlier proposal.  This commit includes all the basic
infrastructure, but locations are only tracked and reported for errors
involving column references, function calls, and operators.  More could
be done later but this seems like a good set to start with.  I've also
moved the ReportSyntaxErrorPosition logic out of psql and into libpq,
which should make it available to more people --- even within psql this
is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
2006-03-14 22:48:25 +00:00
Bruce Momjian 4a85bf3eaf Remove Christof Petig copyright. He already approved removal from an
include file in the same area,.
2006-03-11 16:57:44 +00:00
Bruce Momjian 98d42c2450 Remove copyright notices from Jan (per author approval), and those files
derived from Jan's.
2006-03-11 16:43:22 +00:00
Bruce Momjian f3d99d160d Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +00:00
Neil Conway 7992d0fbca Remove a few places that attempted to define INT_MAX, SCHAR_MAX, and
similar constants if they were not previously defined. All these
constants must be defined by limits.h according to C89, so we can
safely assume they are present.
2006-03-11 01:19:22 +00:00
Tom Lane c65ab0bfa9 Recent changes in memory management in tuplesort.c had a problem: the
case where we run low on array slots before we run low on memory is much
more probable than I had thought, and so it's important to treat each
tape fairly in that case.  To fix this, track per-tape slot allocations
just like we track per-tape space allocation.  Also, in the FINALMERGE
code path avoid scanning all the input tapes when we really only need to
read from one.  This should fix poor behavior with very large work_mem
as exhibited by Stefan Kaltenbrunner.
I didn't do anything about putting an upper bound on the number of tapes,
but maybe we should still consider that.
2006-03-10 23:19:00 +00:00
Tom Lane 9f6192490e Add a CHECK_FOR_INTERRUPTS() in _bt_buildadd(). This fixes problem
with not responding to query cancel during the last stage of btree index
creation.
2006-03-10 20:18:15 +00:00
Neil Conway 0ebf1cc834 Implement 4 new aggregate functions from SQL2003. Specifically: var_pop(),
var_samp(), stddev_pop(), and stddev_samp(). var_samp() and stddev_samp()
are just renamings of the historical Postgres aggregates variance() and
stddev() -- the latter names have been kept for backward compatibility.
This patch includes updates for the documentation and regression tests.
The catversion has been bumped.

NB: SQL2003 requires that DISTINCT not be specified for any of these
aggregates. Per discussion on -patches, I have NOT implemented this
restriction: if the user asks for stddev(DISTINCT x), presumably they
know what they are doing.
2006-03-10 20:15:28 +00:00
Bruce Momjian ab812ef326 Remove unintened change to pg_proc.h. 2006-03-10 19:12:51 +00:00
Bruce Momjian 497b5ad928 Make $PostgreSQL CVS tags consistent for SGML files. 2006-03-10 19:10:50 +00:00
Tom Lane bbfa1c39a1 Add a CHECK_FOR_INTERRUPTS() to the loop in ExecMakeTableFunctionResult.
Otherwise you can't cancel queries like select ... from generate_series(1,1000000).
2006-03-10 01:51:23 +00:00
Bruce Momjian 5931737571 Remove Jan Wieck's name from copyrights, and put in standard
boilerplate, with approval of author.
2006-03-09 21:29:38 +00:00
Bruce Momjian 4c0efd3ae2 Remove Christof Petig copyright on include file, per author request. 2006-03-08 22:00:27 +00:00
Tom Lane c8cd76de28 Tweak trace_sort code to show the merge order (number of active input
tapes) for each merge step.  This will give us some idea of how effective
the merge distribution algorithm is.
2006-03-08 16:59:03 +00:00
Bruce Momjian d233ec299c Update pltcl expected file for E''. 2006-03-08 08:00:35 +00:00
Bruce Momjian c574106a66 Adjust plpython for escape_string_warning. 2006-03-08 04:01:29 +00:00
Bruce Momjian bc0be355c8 Adjust PL regression tests for escape_string_warning. 2006-03-08 03:58:53 +00:00
Tom Lane 43ceb3d449 Further examination of ltsReleaseBlock usage shows that it's got a
performance issue during regular merge passes not only the 'final merge'
case.  The original design contemplated that there would never be more
than about one free block per 'tape', hence no need for an efficient
method of keeping the free blocks sorted.  But given the later addition
of merge preread behavior in tuplesort.c, there is likely to be about
work_mem worth of free blocks, which is not so small ... and for that
matter the number of tapes isn't necessarily small anymore either.  So
we'd better get rid of the assumption entirely.  Instead, I'm assuming
that the usage pattern will involve alternation between merge preread
and writing of a new run.  This makes it reasonable to just add blocks
to the list without sorting during successive ltsReleaseBlock calls,
and then do a qsort() when we start getting ltsGetFreeBlock() calls.
Experimentation seems to confirm that there aren't many qsort calls
relative to the number of ltsReleaseBlock/ltsGetFreeBlock calls.
2006-03-07 23:46:24 +00:00
Tom Lane 8db05ba411 Repair old performance bug in tuplesort.c/logtape.c. In the case where
we are doing the final merge pass on-the-fly, and not writing the data
back onto a 'tape', the number of free blocks in the tape set will become
large, leading to a lot of time wasted in ltsReleaseBlock().  There is
really no need to track the free blocks anymore in this state, so add a
simple shutoff switch.  Per report from Stefan Kaltenbrunner.
2006-03-07 19:06:50 +00:00
Tom Lane e6107da53c Turn off zero_damaged_pages in the right place (ie, in the autovac
process not in the postmaster) and with the right GucSource (needs to
be a nontransactional source since we've not started an xact yet).
2006-03-07 17:32:22 +00:00
Bruce Momjian 8d51c276ca Use SetConfigOption() to turn off "zero_damaged_pages" in autovacuum. 2006-03-07 03:03:09 +00:00
Bruce Momjian 79d25cf775 Back out comment update about sighup, original was accurate. 2006-03-07 03:01:22 +00:00
Bruce Momjian ce1106d2fa Properly set "escape_string_warning" to default to true. 2006-03-07 02:54:23 +00:00
Tom Lane fb51ad3419 Make all our flex and bison files use %option prefix or %name-prefix
(respectively) to rename yylex and related symbols.  Some were doing
it this way already, while others used not-too-reliable sed hacks in
the Makefiles.  It's all nice and consistent now.
2006-03-07 01:03:12 +00:00
Tom Lane 012abebab1 Remove the stub support we had for UNION JOIN; per discussion, this is
not likely ever to be implemented seeing it's been removed from SQL2003.
This allows getting rid of the 'filter' version of yylex() that we had in
parser.c, which should save at least a few microseconds in parsing.
2006-03-07 01:00:19 +00:00
Tom Lane 48cf295742 'make clean' should NOT remove *~ files. 2006-03-07 00:48:07 +00:00
Bruce Momjian d694bd812a Default to ON for 8.2, as announced in the release notes:
escape_string_warning = on
2006-03-06 22:52:10 +00:00
Bruce Momjian d69b163247 Attached is the new patch. To summarize:
- new function justify_interval(interval)
   - modified function justify_hours(interval)
   - modified function justify_days(interval)

These functions are defined to meet the requirements as discussed in
this thread.  Specifically:

   - justify_hours makes certain the sign bit on the hours
     matches the sign bit on the days.  It only checks the
     sign bit on the days, and not the months, when
     determining if the hours should be positive or negative.
     After the call, -24 < hours < 24.

   - justify_days makes certain the sign bit on the days
     matches the sign bit on the months.  It's behavior does
     not depend on the hours, nor does it modify the hours.
     After the call, -30 < days < 30.

   - justify_interval makes sure the sign bits on all three
     fields months, days, and hours are all the same.  After
     the call, -24 < hours < 24 AND -30 < days < 30.

Mark Dilger
2006-03-06 22:49:17 +00:00
Bruce Momjian 19c21d115d Enable standard_conforming_strings to be turned on.
Kevin Grittner
2006-03-06 19:49:20 +00:00
Bruce Momjian a9c1047ebd Update comment on how sighup signal affects postgresql.conf reload.
Markus Bertheau
2006-03-06 18:38:11 +00:00
Bruce Momjian 526f773d2f * Stephen Frost (sfrost@snowman.net) wrote:
>   I've now tested this patch at home w/ 8.2HEAD and it seems to fix the
>   bug.  I plan on testing it under 8.1.2 at work tommorow with
>   mod_auth_krb5, etc, and expect it'll work there.  Assuming all goes
>   well and unless someone objects I'll forward the patch to -patches.
>   It'd be great to have this fixed as it'll allow us to use Kerberos to
>   authenticate to phppgadmin and other web-based tools which use
>   Postgres.

  While playing with this patch under 8.1.2 at home I discovered a
  mistake in how I manually applied one of the hunks to fe-auth.c.
  Basically, the base code had changed and so the patch needed to be
  modified slightly.  This is because the code no longer either has a
  freeable pointer under 'name' or has 'name' as NULL.

  The attached patch correctly frees the string from pg_krb5_authname
  (where it had been strdup'd) if and only if pg_krb5_authname returned
  a string (as opposed to falling through and having name be set using
  name = pw->name;).  Also added a comment to this effect.

Backpatch to 8.1.X.

Stephen Frost
2006-03-06 17:59:30 +00:00
Bruce Momjian 357cc01e57 This patch adds native LDAP auth, for those platforms that don't have
PAM (such as Win32, but also unixen without PAM). On Unix, uses
OpenLDAP. On win32, uses the builin WinLDAP library.

Magnus Hagander
2006-03-06 17:41:44 +00:00
Bruce Momjian 5e3bcac1d9 Fix psql history handling so 'execute' backslash commands (\g)
remain as part of the multi-line query.
2006-03-06 15:09:04 +00:00
Bruce Momjian 4c63b1f88e Prevent autovacuum from zeroing damaged pages. 2006-03-06 05:14:19 +00:00
Bruce Momjian ca8f27998a In psql, save history of backslash commands used in multi-line
statements before the multi-line statement, rather than inside the
multi-line statement.
2006-03-06 04:45:21 +00:00
Neil Conway 99114a2473 Per recent discussion on -hackers, we should sometimes reorder the
columns of the grouping clause to avoid redundant sorts. The optimizer
is not currently capable of doing this, so this patch implements a
simple hack in the analysis phase (transformGroupClause): if any
subset of the GROUP BY clause matches a prefix of the ORDER BY list,
that prefix is moved to the front of the GROUP BY clause. This
shouldn't change the semantics of the query, and allows a redundant
sort to be avoided for queries like "GROUP BY a, b ORDER BY b".
2006-03-05 21:34:34 +00:00
Andrew Dunstan 5d723d05c0 Prepared queries for PLPerl, plus fixing a small plperl memory leak. Patch
and docs from Dmitry Karasik, slightly editorialised.
2006-03-05 16:40:51 +00:00
Bruce Momjian f2f5b05655 Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00