Commit Graph

14613 Commits

Author SHA1 Message Date
Tom Lane 0eaa36a16a Bring syntax of role-related commands into SQL compliance. To avoid
syntactic conflicts, both privilege and role GRANT/REVOKE commands have
to use the same production for scanning the list of tokens that might
eventually turn out to be privileges or role names.  So, change the
existing GRANT/REVOKE code to expect a list of strings not pre-reduced
AclMode values.  Fix a couple other minor issues while at it, such as
InitializeAcl function name conflicting with a Windows system function.
2005-06-28 19:51:26 +00:00
Teodor Sigaev 88b49cdc95 Code cleanup. gistfillbuffer accepts InvalidOffsetNumber. 2005-06-28 15:51:00 +00:00
Tom Lane 365205dd2a Fix broken initdb -W option, per Michael Fuhr. 2005-06-28 15:38:12 +00:00
Tom Lane 7762619e95 Replace pg_shadow and pg_group by new role-capable catalogs pg_authid
and pg_auth_members.  There are still many loose ends to finish in this
patch (no documentation, no regression tests, no pg_dump support for
instance).  But I'm going to commit it now anyway so that Alvaro can
make some progress on shared dependencies.  The catalog changes should
be pretty much done.
2005-06-28 05:09:14 +00:00
Teodor Sigaev e8cab5fe49 Concurrency for GiST
- full concurrency for insert/update/select/vacuum:
        - select and vacuum never locks more than one page simultaneously
        - select (gettuple) hasn't any lock across it's calls
        - insert never locks more than two page simultaneously:
                - during search of leaf to insert it locks only one page
                  simultaneously
                - while walk upward to the root it locked only parent (may be
                  non-direct parent) and child. One of them X-lock, another may
                  be S- or X-lock
- 'vacuum full' locks index
- improve gistgetmulti
- simplify XLOG records

Fix bug in index_beginscan_internal: LockRelation may clean
  rd_aminfo structure, so move GET_REL_PROCEDURE after LockRelation
2005-06-27 12:45:23 +00:00
Tom Lane c3be085ab7 Modify pg_dump to assume that a check constraint is inherited if its
name matches the name of any parent-table constraint, without looking
at the constraint text.  This is a not-very-bulletproof workaround for
the problem exhibited by Berend Tober last month.  We really ought to
record constraint inheritance status in pg_constraint, but it's looking
like that may not get done for 8.1 --- and even if it does, we will
need this kluge for dumping from older servers.
2005-06-27 02:17:47 +00:00
Neil Conway a159ad3048 Remove support for Kerberos V4. It seems no one is using this, it has
some security issues, and upstream has declared it "dead". Patch from
Magnus Hagander, minor editorialization from Neil Conway.
2005-06-27 02:04:26 +00:00
Tom Lane 06ae88a82e Tweak dynahash.c to not allocate so many entries at once when dealing
with a table that has a small predicted size.  Avoids wasting several
hundred K on the timezone hash table, which is likely to have only one
or a few entries, but the entries use up 10Kb apiece ...
2005-06-26 23:32:34 +00:00
Tom Lane 943b396245 Add Oracle-compatible GREATEST and LEAST functions. Pavel Stehule 2005-06-26 22:05:42 +00:00
Tom Lane d395aecffa Code review for escape-strings patch. Sync psql and plpgsql lexers
with main, avoid using a SQL-defined SQLSTATE for what is most definitely
not a SQL-compatible error condition, fix documentation omissions,
adhere to message style guidelines, don't use two GUC_REPORT variables
when one is sufficient.  Nothing done about pg_dump issues.
2005-06-26 19:16:07 +00:00
Tom Lane 3cbd6bc308 Fix overlooked regression output file. 2005-06-26 17:20:04 +00:00
Bruce Momjian bb3cce4ec9 Add E'' syntax so eventually normal strings can treat backslashes
literally.

Add GUC variables:

        "escape_string_warning" - warn about backslashes in non-E strings
        "escape_string_syntax" - supports E'' syntax?
        "standard_compliant_strings" - treats backslashes literally in ''

Update code to use E'' when escapes are used.
2005-06-26 03:04:37 +00:00
Tom Lane c96375a39b Fix a couple of items that should be declared Oid not int. Purely
cosmetic at the moment, but someday Oid might be 64 bits ...
2005-06-25 23:58:58 +00:00
Tom Lane ca1d4eb7f8 Remove forced CHECKPOINT in regression tests --- redundant now that
CREATE DATABASE does one internally.
2005-06-25 23:04:06 +00:00
Tom Lane fbcbc5d06f Force a checkpoint before committing a CREATE DATABASE command. This
should fix the recent reports of "index is not a btree" failures,
as well as preventing a more obscure race condition involving changes
to a template database just after copying it with CREATE DATABASE.
2005-06-25 22:47:29 +00:00
Tom Lane 3acca18d28 Fix ancient memory leak in index_create(): RelationInitIndexAccessInfo
was being called twice in normal operation, leading to a leak of one set
of relcache subsidiary info.  Per report from Jeff Gold.
2005-06-25 16:53:49 +00:00
Tom Lane b90f8f20f0 Extend r-tree operator classes to handle Y-direction tests equivalent
to the existing X-direction tests.  An rtree class now includes 4 actual
2-D tests, 4 1-D X-direction tests, and 4 1-D Y-direction tests.
This involved adding four new Y-direction test operators for each of
box and polygon; I followed the PostGIS project's lead as to the names
of these operators.
NON BACKWARDS COMPATIBLE CHANGE: the poly_overleft (&<) and poly_overright
(&>) operators now have semantics comparable to box_overleft and box_overright.
This is necessary to make r-tree indexes work correctly on polygons.
Also, I changed circle_left and circle_right to agree with box_left and
box_right --- formerly they allowed the boundaries to touch.  This isn't
actually essential given the lack of any r-tree opclass for circles, but
it seems best to sync all the definitions while we are at it.
2005-06-24 20:53:34 +00:00
Tatsuo Ishii 39f3c5d385 unbreak unicode/utf8 test 2005-06-24 15:12:00 +00:00
Tom Lane db53fa6dc7 Remove overspecification of precision of CURRENT_TIMESTAMP, LOCALTIMESTAMP,
CURRENT_TIME, and LOCALTIME: now they just produce "timestamptz" not
"timestamptz(6)", etc.  This makes the behavior more consistent with our
choice to not assign a specific default precision to column datatypes.
It should also save a few cycles at runtime due to not having to invoke
the round-to-given-precision functions.
I also took the opportunity to translate CURRENT_TIMESTAMP into "now()"
instead of an invocation of the timestamptz input converter --- this should
save a few cycles too.
2005-06-24 14:28:06 +00:00
Tatsuo Ishii e2d088de03 Allow direct conversion between EUC_JP and SJIS to improve
performance. patches submitted by Atsushi Ogawa.
2005-06-24 13:56:39 +00:00
Neil Conway 76aa6d29cf Code cleanup: remove 3 duplicate static function declarations. 2005-06-24 01:10:11 +00:00
Neil Conway f2b6edeab8 This trivial patch removes an unused variable. From Alvaro Herrera. 2005-06-24 01:06:26 +00:00
Tom Lane 9a09248edd Fix rtree and contrib/rtree_gist search behavior for the 1-D box and
polygon operators (<<, &<, >>, &>).  Per ideas originally put forward
by andrew@supernews and later rediscovered by moi.  This patch just
fixes the existing opclasses, and does not add any new behavior as I
proposed earlier; that can be sorted out later.  In principle this
could be back-patched, since it changes only search behavior and not
system catalog entries nor rtree index contents.  I'm not currently
planning to do that, though, since I think it could use more testing.
2005-06-24 00:18:52 +00:00
Tom Lane 2f5c47e882 Move findoidjoins out of contrib and into src/tools, which is a more
logical place for it since it is of no use to users.  Per recent
discussions on cleaning up contrib.
2005-06-23 02:33:28 +00:00
Tom Lane 4cc7a93d22 Make REINDEX DATABASE do what one would expect, namely reindex all indexes
in the database.  The old behavior (reindex system catalogs only) is now
available as REINDEX SYSTEM.  I did not add the complementary REINDEX USER
case since there did not seem to be consensus for this, but it would be
trivial to add later.  Per recent discussions.
2005-06-22 21:14:31 +00:00
Tom Lane e98edb5555 Fix the mechanism for reporting the original table OID and column number
of columns of a query result so that it can "see through" cursors and
prepared statements.  Per gripe a couple months back from John DeSoi.
2005-06-22 17:45:46 +00:00
Tom Lane 84d73a6dbc Add a validator function for plperl. Andrew Dunstan 2005-06-22 16:45:51 +00:00
Tom Lane 676bb1ab06 Add a hack requested by the JDBC driver writers: when a function's
argument list contains parameter symbols ($n) declared as type VOID,
discard these arguments.  This allows the driver to avoid renumbering
mixed IN and OUT argument placeholders (the JDBC syntax involves writing
? for both IN and OUT parameters, but on the server side we don't think
that OUT parameters are arguments).  This doesn't break any currently-
useful cases since VOID is not used as an input argument type.
2005-06-22 15:19:43 +00:00
Neil Conway 738df437b2 Fix bug in CONTINUE statement for PL/pgSQL: when we continue a loop,
we need to be careful to reset rc to PLPGSQL_RC_OK, depending on how
the loop's logic is structured. If we continue a loop but it then
exits without executing the loop's body again, we want to return
PLPGSQL_RC_OK to our caller.  Enhance the regression tests to catch
this problem. Per report from Michael Fuhr.
2005-06-22 07:28:47 +00:00
Neil Conway 05db8b501b Correct some code in pg_restore when reading the header of a tar archive:
(1) The code doesn't initialize `sum', so the initial "does the checksum
    match?" test is wrong.

(2) The loop that is intended to check for a "null block" just checks
    the first byte of the tar block 512 times, rather than each of the
    512 bytes one time (!), which I'm guessing was the intent.

It was only through sheer luck that this worked in the first place.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-22 02:00:47 +00:00
Neil Conway 06ecacded6 More trivial dead code removal: in int_to_roman(), checking for "num == -1"
is redundant after a check has already been made for "num < 0". The "set"
variable can also be removed, as it is now no longer used. Per checking
with Karel, this is the right fix.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-22 01:43:05 +00:00
Neil Conway ebcb4c931d Add a CONTINUE statement to PL/PgSQL, which can be used to begin the
next iteration of a loop. Update documentation and add regression tests.
Patch from Pavel Stehule, reviewed by Neil Conway.
2005-06-22 01:35:03 +00:00
Tom Lane 7a28de2052 pg_dump can now dump large objects even in plain-text output mode, by
using the recently added lo_create() function.  The restore logic in
pg_restore is greatly simplified as well, since there's no need anymore
to try to adjust database references to match a new set of blob OIDs.
2005-06-21 20:45:44 +00:00
Tom Lane b49d871f6a Fix pg_dumpall to do the right thing with "postgres" database, per
Dave Page.  Also, cause it to emit rather than ignore any ACL and
datconfig options that may be set for these two databases.
2005-06-21 15:22:18 +00:00
Tom Lane 6f7fc0bade Cause initdb to create a third standard database "postgres", which
unlike template0 and template1 does not have any special status in
terms of backend functionality.  However, all external utilities such
as createuser and createdb now connect to "postgres" instead of
template1, and the documentation is changed to encourage people to use
"postgres" instead of template1 as a play area.  This should fix some
longstanding gotchas involving unexpected propagation of database
objects by createdb (when you used template1 without understanding
the implications), as well as ameliorating the problem that CREATE
DATABASE is unhappy if anyone else is connected to template1.
Patch by Dave Page, minor editing by Tom Lane.  All per recent
pghackers discussions.
2005-06-21 04:02:34 +00:00
Neil Conway ec3a1af0a8 Fix a potential backend crash during authentication when parsing a
malformed ident map file.  This was introduced by the linked list
rewrite in 8.0 -- mea maxima culpa.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-21 01:20:09 +00:00
Neil Conway 09d1110c2a Trivial dead code removal: in CreateSchemaCommand(), 'owner_name' is
only used in one branch of an if statement, so we can move its
declaration to that block. This also avoids an unnecessary syscache
lookup.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-21 00:58:15 +00:00
Neil Conway 2d4b9736bb Trivial dead code removal: in _complete_from_query(), 'text' cannot be
NULL (e.g. due to the preceding strlen()). Therefore we needn't recheck
this before initializing 'e_text'.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-21 00:48:33 +00:00
Neil Conway 141e878bc3 Trivial dead code removal: in makeObjectName(), name1 must be non-NULL
(due to the preceding strlen(), for example), so we needn't recheck this
before invoking pg_mbcliplen().

Per Coverity static analysis performed by EnterpriseDB.
2005-06-21 00:35:05 +00:00
Tom Lane 638feae2c9 exec_eval_datum leaks memory when dealing with ROW or REC values.
It never leaked memory before PG 8.0, so none of the callers are
expecting this.  Cleanest fix seems to be to make it allocate the needed
memory in estate->eval_econtext, where it will be cleaned up by
the next exec_eval_cleanup.  Per report from Bill Rugolsky.
2005-06-20 22:51:29 +00:00
Tom Lane 59ee9448a8 Remove read_file/write_file tests. These were originally intended to
*fail*, to test that plpython didn't allow untrusted operations.
When we changed plpython to plpythonu because python didn't actually have
a secure sandbox mode, someone (probably me :-() misinterpreted the tests
as checking whether Python's file I/O works.  Which is a stupid thing for
us to be testing.  Remove it so we don't clutter the filesystem with
random temporary files.
2005-06-20 21:14:01 +00:00
Tom Lane 9d7c005243 plpgsql's exec_assign_value() freed the old value of a variable before
copying/converting the new value, which meant that it failed badly on
"var := var" if var is of pass-by-reference type.  Fix this and a similar
hazard in exec_move_row(); not sure that the latter can manifest before
8.0, but patch it all the way back anyway.  Per report from Dave Chapeskie.
2005-06-20 20:44:44 +00:00
Tom Lane b95ae32b41 Avoid WAL-logging individual tuple insertions during CREATE TABLE AS
(a/k/a SELECT INTO).  Instead, flush and fsync the whole relation before
committing.  We do still need the WAL log when PITR is active, however.
Simon Riggs and Tom Lane.
2005-06-20 18:37:02 +00:00
Teodor Sigaev 1bfdd1a893 fix founded hole in recovery after crash, add vacuum_delay_point() 2005-06-20 15:22:38 +00:00
Teodor Sigaev d544ec8bbd 1. full functional WAL for GiST
2. improve vacuum for gist
   - use FSM
   - full vacuum:
      - reforms parent tuple if it's needed
        ( tuples was deleted on child page or parent tuple remains invalid
          after crash recovery )
      - truncate index file if possible
3. fixes bugs and mistakes
2005-06-20 10:29:37 +00:00
Neil Conway 0b62bbe086 Cosmetic improvements to the timezone code: remove the use of the
'register' qualifier, make some function declarations more consistent,
and so on.
2005-06-20 08:00:51 +00:00
Tom Lane ec490f5159 Change shell syntax that seems not to work right on FreeBSD 6-CURRENT
buildfarm machines.
2005-06-20 02:26:50 +00:00
Tom Lane d38d06374d Add lock file contents printout to "can't happen" case to help
investigate buildfarm failures.
2005-06-20 02:17:30 +00:00
Neil Conway 9de97c5531 Trivial code clarity improvement to UpdateStats(); no functional change. 2005-06-20 02:07:47 +00:00
Tom Lane d961a56899 Avoid unnecessary palloc overhead in _bt_first(). The temporary
scankeys arrays that it needs can never have more than INDEX_MAX_KEYS
entries, so it's reasonable to just allocate them as fixed-size local
arrays, and save the cost of palloc/pfree.  Not a huge savings, but
a cycle saved is a cycle earned ...
2005-06-19 22:41:00 +00:00