Commit Graph

5421 Commits

Author SHA1 Message Date
Tom Lane aab47baf6c Hack to make it possible to load CREATE CONSTRAINT TRIGGER commands that
are missing the FROM clause (due to a long-ago pg_dump bug).  Patch by
Stephan Szabo, minor tweaking by Tom Lane.
2002-10-03 21:06:23 +00:00
Tom Lane 565c97bea5 In a bootstrap process or standalone backend, set MaxBackends = 1
to avoid unnecessary consumption of semaphores.
2002-10-03 19:19:09 +00:00
Tom Lane edf497dec9 Avoid palloc(0) when MaxBackends = 1. 2002-10-03 19:17:55 +00:00
Bruce Momjian 793a4ba35e Add SSL documentation info to README.SSL 2002-10-03 17:26:14 +00:00
Bruce Momjian a0bf2503ea The attached patch fixes a number of issues related to compiling the
client
utilities (libpq.dll and psql.exe) for win32 (missing defines,
adjustments to
includes, pedantic casting, non-existent functions) per:
   http://developer.postgresql.org/docs/postgres/install-win32.html.

It compiles cleanly under Windows 2000 using Visual Studio .net. Also
compiles clean and passes all regression tests (regular and contrib)
under Linux.

In addition to a review by the usual suspects, it would be very
desirable for  someone well versed in the peculiarities of win32 to take
a look.

Joe Conway
2002-10-03 17:09:42 +00:00
Bruce Momjian d4eae72513 This patch removes two unused global variables from globals.c
Neil Conway
2002-10-03 17:07:53 +00:00
Tom Lane b813d143ae Alter scale selection for NUMERIC division and transcendental functions
so that precision of result is always at least as good as you'd get from
float8 arithmetic (ie, always at least 16 digits of accuracy).  Per
pg_hackers discussion a few days ago.
2002-10-02 19:21:26 +00:00
Bruce Momjian c74c7e604c Turn GUC log_min_error_statement off by default by setting it to PANIC. 2002-10-02 16:27:57 +00:00
Tom Lane 361f1e1656 Pass less-unsafe parameters to Darwin's NSLinkModule. While this change prevents a backend coredump when loading a broken shlib, it also seems to suppress the error messages that might help debug the problem :-(. Perhaps someone would like to supply a 'linkEdit' hook to get the best of both worlds. But in the meantime, backend crash trumps error reporting. 2002-10-01 05:06:44 +00:00
Bruce Momjian 2a1e4a9006 Add Bear's SSL comments. 2002-09-29 04:06:54 +00:00
Tom Lane 6d0d15c451 Make the world at least somewhat safe for zero-column tables, and
remove the special case in ALTER DROP COLUMN to prohibit dropping a
table's last column.
2002-09-28 20:00:19 +00:00
Tom Lane 23616b47d5 ARGH!
Vacuum must not advance pg_database.datvacuumxid nor truncate CLOG
unless it's processed *all* tables in the database.  Vacuums run by
unprivileged users don't count.

(Beats head against nearest convenient wall...)
2002-09-27 20:57:08 +00:00
Tom Lane d2d0f42040 Use heap_formtuple not heap_addheader to construct pg_index tuples.
heap_addheader is wrong because it doesn't cope with varlena fields,
notably indpred.
2002-09-27 15:05:23 +00:00
Tom Lane cb253de21a Don't mess with HEAP_XMAX_INVALID in heaptuple.c routines; there is
no reason to worry about the tuple commit status bits until the tuple
is inserted in a relation by heapam.c.  Also, improve comments for
heap_addheader().
2002-09-27 15:04:08 +00:00
Bruce Momjian 0b1b377569 Have -d5 -d0 not affect the extra variables set with -d5. 2002-09-27 03:59:00 +00:00
Bruce Momjian 1fe4cbb9db Make postgres -d0 set server_min_messages to notice. Reset doesn't work
at this area in the code.
2002-09-27 03:34:15 +00:00
Tom Lane b2ab1e6bc9 Ensure that before truncating CLOG, we force a checkpoint even if no
recent WAL activity has occurred.  Without this, it's possible that a
later crash might leave tuples on disk with un-updated commit status
bits.
2002-09-26 22:58:34 +00:00
Tom Lane c87469e64a Fix problems with loss of tuple commit status bits during WAL redo of
VACUUM FULL tuple moves.  Store full-width t_infomask in WAL, rather
than storing low 8 bits and expecting to be able to reconstruct upper
bits.  While at it, remove redundant t_oid field from WAL headers
(the OID, if present, is now recorded in the data portion of the tuple).
WAL version number bumped --- this does not force an initdb, you can
instead run pg_resetxlog after a clean shutdown of the old postmaster.
2002-09-26 22:46:29 +00:00
Bruce Momjian 5ad4faf13a This patch removes a use of uninitialized memory in lmgr/lock.c, by
adding a missing sprintf().

Neil Conway
2002-09-26 05:18:30 +00:00
Bruce Momjian 3c104bc4ed Pass postmaster -d down to the postgres backend to trigger special -d
handling in the backend.
2002-09-26 05:17:00 +00:00
Bruce Momjian 15b95cf872 Allow SSL to work withouth client-side certificate infrastructure. 2002-09-26 04:41:55 +00:00
Tom Lane 8a6fab412e Remove ShutdownBufferPoolAccess exit callback, and do the work in
ProcKill instead, where we still have a PGPROC with which to wait on
LWLocks.  This fixes 'can't wait without a PROC structure' failures
occasionally seen during backend shutdown (I'm surprised they weren't
more frequent, actually).  Add an Assert() to LWLockAcquire to help
catch any similar mistakes in future.  Fix failure to update MyProcPid
for standalone backends and pgstat processes.
2002-09-25 20:31:40 +00:00
Tom Lane c6367df506 Change default privileges for languages and functions to be PUBLIC USAGE
and PUBLIC EXECUTE, respectively.  Per discussion about easing updates
from prior versions.
2002-09-24 23:14:25 +00:00
Peter Eisentraut 8c3ab663ab Tweak conversion names to follow the established naming scheme, and
document that scheme.
2002-09-24 20:14:59 +00:00
Tom Lane 83fd58dff0 Add missing correction of sublevelsup when pulling up a subquery.
Fixes problem with cases like
SELECT * FROM foo t WHERE NOT EXISTS (SELECT remoteid FROM
(SELECT f1 as remoteid FROM foo WHERE f1 = t.f1) AS t1)
2002-09-24 18:38:23 +00:00
Tom Lane 233ecca7c9 Further thinking about heap_mark4update: in HeapTupleSelfUpdated case,
executor should not return the tuple as successfully marked, because in
fact it's been deleted.  Not clear that this case has ever been seen
in practice (I think you'd have to write a SELECT FOR UPDATE that calls
a function that deletes some row the SELECT will visit later...) but we
should be consistent.  Also add comments to several other places that
got it right but didn't explain what they were doing.
2002-09-23 22:57:44 +00:00
Tom Lane 5fa3418304 Disallow VACUUM, ANALYZE, TRUNCATE on temp tables belonging to other
backends.  Given that temp tables now store data locally in the local
buffer manager, these things are not going to work safely.
2002-09-23 20:43:41 +00:00
Tom Lane bc1088c28a Get rid of bogus use of heap_mark4update in reindex operations (cf.
recent bug report).  Fix processing of nailed-in-cache indexes;
it appears that REINDEX DATABASE has been broken for months :-(.
2002-09-23 00:42:48 +00:00
Tom Lane df3e7b3a51 In UpdateStats(), don't bother to update the pg_class row if it already
contains the correct statistics.  This is a partial solution for the
problem of allowing concurrent CREATE INDEX commands: unless they commit
at nearly the same instant, the second one will see the first one's
pg_class updates as committed, and won't try to update again, thus
avoiding the 'tuple concurrently updated' failure.
2002-09-22 23:03:58 +00:00
Tom Lane 0582874506 Remove commas from %type and %token lists, for compatibility with newer
versions of bison.
2002-09-22 21:44:43 +00:00
Peter Eisentraut 2972fd5d83 Translation updates, some messages tweaked. 2002-09-22 20:57:21 +00:00
Tom Lane 3503f19eeb RelationClearRelation must reset rd_targblock and update rd_nblocks
even when dealing with a nailed-in-cache relation; otherwise, following
VACUUM truncation of a system catalog, other backends might have
unreasonably large values of these fields.
2002-09-22 20:56:28 +00:00
Tom Lane 0b620e33db server_min_messages and friends should have valid values at bootup. 2002-09-22 19:52:38 +00:00
Tom Lane c328b6dd8b Replace pg_attribute.attisinherited with attislocal and attinhcount
columns, to allow more correct behavior in multiple-inheritance cases.
Patch by Alvaro Herrera, review by Tom Lane.
2002-09-22 19:42:52 +00:00
Tom Lane 9946b83ded Bring SIMILAR TO and SUBSTRING into some semblance of conformance with
the SQL99 standard.  (I'm not sure that the character-class features are
quite right, but that can be fixed later.)  Document SQL99 and POSIX
regexps as being different features; provide variants of SUBSTRING for
each.
2002-09-22 17:27:25 +00:00
Tom Lane ac355d558e Move most of the error checking for foreign-key constraints out of
parse analysis and into the execution code (in tablecmds.c).  This
eliminates a lot of unreasonably complex code that needed to have two
or more execution paths in case it was dealing with a not-yet-created
table column vs. an already-existing one.  The execution code is always
dealing with already-created tables and so needs only one case.  This
also eliminates some potential race conditions (the table wasn't locked
between parse analysis and execution), makes it easy to fix the gripe
about wrong referenced-column names generating a misleading error message,
and lets us easily add a dependency from the foreign-key constraint to
the unique index that it requires the referenced table to have.  (Cf.
complaint from Kris Jurka 12-Sep-2002 on pgsql-bugs.)

Also, third try at building a deletion mechanism that is not sensitive
to the order in which pg_depend entries are visited.  Adding the above-
mentioned dependency exposed the folly of what dependency.c had been
doing: it failed for cases where B depends on C while both auto-depend
on A.  Dropping A should succeed in this case, but was failing if C
happened to be visited before B.  It appears the only solution is two
separate walks over the dependency tree.
2002-09-22 00:37:09 +00:00
Tom Lane e303a2dbe8 Add last-ditch defense against attempts to compile datetime code with
-ffast-math.
2002-09-21 19:52:41 +00:00
Tom Lane eb3adab568 Provide an upgrade strategy for dump files containing functions declared
with OPAQUE.  CREATE LANGUAGE, CREATE TRIGGER, and CREATE TYPE will all
accept references to functions declared with OPAQUE --- but they will
issue a NOTICE, and will modify the function entries in pg_proc to have
the preferred type-safe argument or result types instead of OPAQUE.
Per recent pghackers discussions.
2002-09-21 18:39:26 +00:00
Tom Lane 7233aae50b Fix PPC s_lock operations to work correctly on multi-CPU machines.
Need 'isync' during TAS and 'sync' during S_UNLOCK.
2002-09-21 00:14:05 +00:00
Tom Lane b2735fcd52 Performance improvement for MultiRecordFreeSpace on large relations ---
avoid O(N^2) behavior.  Problem noted and fixed by Stephen Marshall <smarshall@wsicorp.com>,
with some help from Tom Lane.
2002-09-20 19:56:01 +00:00
Tom Lane 316d4e29b2 Code review for check-domain-constraints-in-COPY patch. Do correct thing
when default expression for a domain is being used.  Avoid repetitive
catalog lookups.
2002-09-20 16:56:02 +00:00
Bruce Momjian 5d115bb548 Change domain patch to COERCE_IMPLICIT_CAST, per Tom. 2002-09-20 15:43:03 +00:00
Bruce Momjian a1199e0c4c Fix compile error from Rod's patch. 2002-09-20 15:29:44 +00:00
Bruce Momjian c27d95e25d The patch fix bug described in TODO:
* to_char(0,'FM999.99') returns a period, to_char(1,'FM999.99') does not

Karel Zak
2002-09-20 03:57:09 +00:00
Bruce Momjian c51a049ef2 Tom Lane wrote:
> I see in your recent bytea-LIKE patch
>
>         if (datatype != BYTEAOID && pg_database_encoding_max_length()
> 1)
>             len = pg_mbcliplen((const unsigned char *) workstr, len,
len - 1);
>         else
>             len -= -1;
>
> Surely there's one too many minus signs in that last?

Joe Conway
2002-09-20 03:55:40 +00:00
Bruce Momjian 192b0c94f2 This patch cleans up some of the code in src/util/adt/formatting.c,
fixes a few minor bugs (typos, potential buffer overruns, etc.), and
fixes some spelling/grammar mistakes.

Neil Conway
2002-09-20 03:54:57 +00:00
Bruce Momjian 229eebd559 This patch fixes two typos in src/backend/storage/ipc/README.
Neil Conway
2002-09-20 03:53:55 +00:00
Bruce Momjian 07a6fa9df1 Fixed this problem and added regression tests in domain.sql.
Also:
- Changed header file order (alphabetical)
- Changed to m = attnum - 1 in binary copy code for consistency

Rod Taylor
2002-09-20 03:52:50 +00:00
Bruce Momjian a834cbe1e9 > I'm not sure why NDirectFileRead/NDirectFileWrite are unused at the
> moment, but they used to be used; I think the correct response is to
> put back the missing counter increments, not rip out the counters.

Ok, fair enough. It's worth noting that they've been broken for a
while -- for example, the HashJoin counter increments were broken when
you comitted r1.20 of executor/nodeHashJoin.c in May of '99.

I've attached a revised patch that doesn't remove the counters (but
doesn't increment them either: I'm not sure of all the places where
the counter should be incremented).

Neil Conway
2002-09-20 03:45:08 +00:00
Tom Lane da395b56cd Tweak heap.c to refuse attempts to create table columns of standalone
composite types.  Add a couple more lsyscache.c routines to support this,
and make use of them in some other places that were doing lookups the
hard way.
2002-09-19 23:40:56 +00:00
Tom Lane 4a0c3a6142 Department of second thoughts: suppressing implicit casts everywhere in
ruleutils display is not such a great idea.  For arguments of functions
and operators I think we'd better keep the historical behavior of showing
such casts explicitly, to ensure that the function/operator is reparsed
the same way when the rule is reloaded.  This also makes the output of
EXPLAIN less obscurantist about exactly what's happening.
2002-09-19 22:48:34 +00:00
Tom Lane b26dfb9522 Extend pg_cast castimplicit column to a three-way value; this allows us
to be flexible about assignment casts without introducing ambiguity in
operator/function resolution.  Introduce a well-defined promotion hierarchy
for numeric datatypes (int2->int4->int8->numeric->float4->float8).
Change make_const to initially label numeric literals as int4, int8, or
numeric (never float8 anymore).
Explicitly mark Func and RelabelType nodes to indicate whether they came
from a function call, explicit cast, or implicit cast; use this to do
reverse-listing more accurately and without so many heuristics.
Explicit casts to char, varchar, bit, varbit will truncate or pad without
raising an error (the pre-7.2 behavior), while assigning to a column without
any explicit cast will still raise an error for wrong-length data like 7.3.
This more nearly follows the SQL spec than 7.2 behavior (we should be
reporting a 'completion condition' in the explicit-cast cases, but we have
no mechanism for that, so just do silent truncation).
Fix some problems with enforcement of typmod for array elements;
it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
Provide a generalized array_length_coerce() function to replace the
specialized per-array-type functions that used to be needed (and were
missing for NUMERIC as well as all the datetime types).
Add missing conversions int8<->float4, text<->numeric, oid<->int8.
initdb forced.
2002-09-18 21:35:25 +00:00
Tatsuo Ishii 4b23f05c4f Fix bug in encoding conversion map. 2002-09-18 02:10:10 +00:00
Tatsuo Ishii 4c0bdd1ba8 Update Japanese README so that it reflects the changes made to the
conversion function interface.
2002-09-18 01:21:28 +00:00
Bruce Momjian a2ba9a76b8 Remove retest Makefile entry because it does not compile. 2002-09-16 16:02:43 +00:00
Tom Lane 53e95eee84 Fix for rare race-condition-like failure: if a backend receives SIGUSR2
(notify/SI-overrun interrupt) while it is in process of doing proc_exit,
it is possible for Async_NotifyHandler() to try to start a transaction
when one is already running.  This leads to Asserts() or worse.  I think
it may only be possible to occur when frontend synchronization is lost
(ie, the elog(FATAL) in SocketBackend() fires), but that is a standard
occurrence after error during COPY.  In any case, I have seen this
failure occur during regression tests, so it is definitely possible.
2002-09-16 01:24:41 +00:00
Peter Eisentraut 5ea9322872 Cast functions can be immutable or stable. 2002-09-15 13:04:16 +00:00
Tom Lane db4f3c0334 Update obsolete comment. 2002-09-14 22:14:49 +00:00
Tom Lane c91b8bc537 Cosmetic fixes from Neil Conway. 2002-09-14 19:59:20 +00:00
Peter Eisentraut 49c86099f3 Shrink the pg_hba.conf and pg_ident.conf default files and move most of the
inline documentation to the main docs.
2002-09-14 18:35:46 +00:00
Peter Eisentraut d73f8137d2 Translation updates 2002-09-14 13:46:24 +00:00
Tatsuo Ishii 3357577247 Change Assert(len > 0) to Assert(len >= 0)
Change PG_RETURN_INT32(0) to PG_RETURN_VOID()
2002-09-13 06:41:18 +00:00
Tom Lane feb202193d Fix likely cause of rare ALTER TABLE ADD FOREIGN KEY failures ---
don't assume relname field of a relcache entry will stay valid across
lots of operations.
2002-09-12 21:16:42 +00:00
Tom Lane 2b0319869a Avoid misleading error message when SET/RESET target variable name
doesn't match any known variable.
2002-09-12 14:03:45 +00:00
Tom Lane 6fdc44be71 Tweak querytree-dependency-extraction code so that columns of tables
that are explicitly JOINed are not considered dependencies unless they
are actually used in the query: mere presence in the joinaliasvars
list of a JOIN RTE doesn't count as being used.  The patch touches
a number of files because I needed to generalize the API of
query_tree_walker to support an additional flag bit, but the changes
are otherwise quite small.
2002-09-11 14:48:55 +00:00
Tom Lane 94d8a798fa Powerup defaults for LC_foo GUC variables should match what main.c does. 2002-09-10 16:09:02 +00:00
Tom Lane 9a9825f96a Remove heap_mark4update from AlterTableCreateToastTable. This has
never been the correct procedure for locking a relation, and the
recently-found ALTER TABLE bug with adding a constraint and a toast
table in the same command shows why it's a bad idea.
2002-09-06 00:01:53 +00:00
Tom Lane 6fe27ca2fb Fix some operator-precedence problems. New constructs IS DISTINCT FRM
and IS [NOT] OF were not being parsed consistently with other IS forms.
Also, make the world a little safer for functions named LEFT, RIGHT, etc.
2002-09-05 22:52:48 +00:00
Peter Eisentraut 337da0678a Assorted fixes for Cygwin:
Eliminate the mysterious games that the Cygwin build plays with the linker
flag variables.  DLLLIBS is gone, use SHLIB_LINK like everyone else.
Detect cygipc in configure, after the linker flags are set up, otherwise
configure might not work at all.

Make sure everything is covered by make clean.

Fix the build of the new conversion procedure modules.

Add new DLLIMPORT markers where required.

Finally, the compiler complains if we use an explicit
-I/usr/local/include, so don't do that.  Curiously, -L/usr/local/lib is
still necessary.
2002-09-05 18:28:46 +00:00
Peter Eisentraut 1e91782533 Fix compilation warning. (Cygwin has char* as second argument of
recvfrom(), not void*.)
2002-09-05 18:26:18 +00:00
Tom Lane 52c9d25933 Be careful to include postgres.h *before* any system headers, to ensure
that the right flavors of largefile-related definitions are seen.
Most of these changes are probably unnecessary, but better safe than
sorry.
2002-09-05 00:43:07 +00:00
Tom Lane 3f63787cbf Guard against send-lots-and-lots-of-data DoS attack from unauthenticated
users, by limiting the length of string we will accept for a password.
Patch by Serguei Mokhov, some editorializing by Tom Lane.
2002-09-04 23:31:35 +00:00
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +00:00
Tom Lane 07c67187bf Avoid multiple scans of utils/mb/conversion_procs/ subdirectories during
'make install'; there are enough of 'em that this slowed down the make
noticeably.  Ensure that 'all' is the default make target in all these
directories (defaulting to 'make install' is surprising and dangerous
IMHO).  Fix a couple small typos.
2002-09-04 15:45:50 +00:00
Tatsuo Ishii 97592e6a6c Refrect the changes to src/test/regress/sql/conversion.sql By Tom. 2002-09-04 02:42:34 +00:00
Tom Lane b3506006b5 EXTRACT(EPOCH FROM timestamp) gave wrong answers in the int64-timestamp
case for timestamptz input, and differently wrong answers in the float-
timestamp case for timestamp input.
2002-09-03 22:55:54 +00:00
Tom Lane d61de58906 Arrange for the default permissions on a database to allow temp table
creation to world, but disallow temp table creation in template1.  Per
latest round of pghackers discussion.
I did not force initdb, but the permissions lockdown on template1 will
not take effect unless you do one (or manually REVOKE TEMP ON DATABASE template1 FROM public).
2002-09-03 22:17:35 +00:00
Peter Eisentraut 77f7763b55 Remove all traces of multibyte and locale options. Clean up comments
referring to "multibyte" where it really means character encoding.
2002-09-03 21:45:44 +00:00
Tom Lane 86f27321e2 Work around mktime() brain damage in recent versions of glibc by using
a series of localtime() calls to determine the local timezone offset
when mktime() fails.  This eliminates regression failures on RHL 7.3,
and should continue to work until it occurs to the glibc boys to break
localtime() as well.  By then I hope we'll have our own timezone code...
2002-09-03 19:46:32 +00:00
Tom Lane 4885dabe9d Eliminate unnecessary dependency on mktime(), and consequent 'Unable to
convert date to tm' failures, by using DetermineLocalTimeZone() instead.
2002-09-03 19:41:28 +00:00
Peter Eisentraut c917660a11 Workaround for format strings that are concatenated from macros
(INT64_FORMAT), which gettext cannot handle.
2002-09-03 18:50:54 +00:00
Tom Lane a3c9ef766b I think reindex_index had better get AccessExclusiveLock on the parent
heap, not just ExclusiveLock.
2002-09-03 16:00:02 +00:00
Tom Lane ab82bde7e0 Code review and documentation updates for indisclustered patch. 2002-09-03 01:04:41 +00:00
Peter Eisentraut b28b05317d Translation updates 2002-09-02 22:22:12 +00:00
Tom Lane 8f60f43f2e Department of second thoughts: make checks for replacing a view slightly
more flexible, and improve the error reporting.  Also, add documentation
for REPLACE RULE/VIEW.
2002-09-02 20:04:40 +00:00
Bruce Momjian 595a5a78e0 > Okay. When you get back to the original issue, the gold is hidden in
> src/backend/optimizer/path/indxpath.c; see the "special indexable
> operators" stuff near the bottom of that file.  (It's a bit of a crock
> that this code is hardwired there, and not somehow accessed through a
> system catalog, but it's what we've got at the moment.)

The attached patch re-enables a bytea right hand argument (as compared
to a text right hand argument), and enables index usage, for bytea LIKE

Joe Conway
2002-09-02 06:22:20 +00:00
Bruce Momjian a12b4e279b I checked all the previous string handling errors and most of them were
already fixed by You. However there were a few left and attached patch
should fix the rest of them.

I used StringInfo only in 2 places and both of them are inside debug
ifdefs. Only performance penalty will come from using strlen() like all
the other code does.

I also modified some of the already patched parts by changing
snprintf(buf, 2 * BUFSIZE, ... style lines to
snprintf(buf, sizeof(buf), ... where buf is an array.

Jukka Holappa
2002-09-02 06:11:43 +00:00
Bruce Momjian 9fd842c4b2 Add GUC variable to print original query to the server logs when there
is an error, warning, etc.

Gavin Sherry
2002-09-02 05:42:54 +00:00
Bruce Momjian 6a8babc206 Remove documentation that says debug_query_string is only used by
pgmonitor.

Now log_min_error_statement uses it.
2002-09-02 05:25:37 +00:00
Bruce Momjian 97ac103289 Remove sys/types.h in files that include postgres.h, and hence c.h,
because c.h has sys/types.h.
2002-09-02 02:47:07 +00:00
Tom Lane 248c67d7ed CREATE OR REPLACE VIEW, CREATE OR REPLACE RULE.
Gavin Sherry, Neil Conway, and Tom Lane all got their hands dirty
on this one ...
2002-09-02 02:13:02 +00:00
Tom Lane c7a165adc6 Code review for HeapTupleHeader changes. Add version number to page headers
(overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask,
per earlier discussion.  Simplify scheme for overlaying fields in tuple
header (no need for cmax to live in more than one place).  Don't try to
clear infomask status bits in tqual.c --- not safe to do it there.  Don't
try to force output table of a SELECT INTO to have OIDs, either.  Get rid
of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which
has already caused one recent failure.  Improve documentation.
2002-09-02 01:05:06 +00:00
Bruce Momjian 548d646e65 Add log_duration to GUC/postgresql.conf.
Rename debug_print_query to log_statement and rename show_query_stats to
show_statement_stats.
2002-09-01 23:26:06 +00:00
Tom Lane 681ed4e2fe Code cleanups: make non-implicit WITHOUT FUNCTION casts work, avoid
redundant pg_cast searches, fix obsolete comments.
2002-09-01 02:27:32 +00:00
Bruce Momjian d64e6392fb Remove code that suggested increasing wal_files. 2002-09-01 01:58:42 +00:00
Tom Lane 3c49c4b152 Mark the float8 -> int8 cast as implicit. This resolves the problem
pointed out by Barry Lind: UPDATE bigintcol = 10000000000 fails because
the constant is initially taken as float8.  We really need a better way,
but it's not gonna happen for 7.3.

Also, remove int4reltime() function, which is redundant with the
existing binary-compatibility coercion path from int4 to reltime,
and probably has been unreachable code for a long while.
2002-09-01 00:58:07 +00:00
Tom Lane 845a6c3acc Code review for domain-constraints patch. Use a new ConstraintTest node
type for runtime constraint checks, instead of misusing the parse-time
Constraint node for the purpose.  Fix some damage introduced into type
coercion logic; in particular ensure that a coerced expression tree will
read out the correct result type when inspected (patch had broken some
RelabelType cases).  Enforce domain NOT NULL constraints against columns
that are omitted from an INSERT.
2002-08-31 22:10:48 +00:00
Tom Lane 1440acd703 Wups, didn't mean to commit that just yet. 2002-08-31 19:10:08 +00:00
Tom Lane 0da6cf54ec The UNDEFOID later causes an assertion failure in heap_formtuple when
you try to use the tupdesc to build a tuple.

Joe Conway
2002-08-31 19:09:27 +00:00
Tom Lane 1bab464eb4 Code review for pg_locks feature. Make shmemoffset of PROCLOCK structs
available (else there's no way to interpret the list links).  Change
pg_locks view to show transaction ID locks separately from ordinary
relation locks.  Avoid showing N duplicate rows when the same lock is
held multiple times (seems unlikely that users care about exact hold
count).  Improve documentation.
2002-08-31 17:14:28 +00:00
Tom Lane 7bacf2befa Add expected tuple descriptor to ReturnSetInfo information for table
functions, per suggestion from John Gray and Joe Conway.  Also, fix
plpgsql RETURN NEXT to verify that returned values match the expected
tupdesc.
2002-08-30 23:59:46 +00:00
Tom Lane 26993b2918 AUTOCOMMIT mode is now an available backend GUC variable; setting it
to false provides more SQL-spec-compliant behavior than we had before.
I am not sure that setting it false is actually a good idea yet; there
is a lot of client-side code that will probably be broken by turning
autocommit off.  But it's a start.

Loosely based on a patch by David Van Wie.
2002-08-30 22:18:07 +00:00
Tom Lane 549928d99b Fix for breakage of C-coded SRFs, from Joe Conway. 2002-08-30 19:56:49 +00:00
Tom Lane e2d156fa6e Add attisinherited column to pg_attribute; use it to guard against
column additions, deletions, and renames that would let a child table
get out of sync with its parent.  Patch by Alvaro Herrera, with some
kibitzing by Tom Lane.
2002-08-30 19:23:20 +00:00
Bruce Momjian 63653f7ffa Complete TODO item:
* Remove wal_files postgresql.conf option because WAL files are
	  now recycled
2002-08-30 16:50:50 +00:00
Bruce Momjian f7e089b3fa Back out password packet length check.
Improve wording of pre-7.3 syntax mention.
2002-08-30 16:00:41 +00:00
Tom Lane fac3dd56b3 Group-manipulating code neglected to fill in array element type,
which is now required.
2002-08-30 01:01:02 +00:00
Tom Lane e107f3a7e3 PL/pgSQL functions can return sets. Neil Conway's patch, modified so
that the functionality is available to anyone via ReturnSetInfo, rather
than hard-wiring it to PL/pgSQL.
2002-08-30 00:28:41 +00:00
Hiroshi Inoue 82ccb420d5 Fix a bug introduced in 7.2. 2002-08-29 23:39:05 +00:00
Bruce Momjian 9858a3a43f Sir Mordred The Traitor <mordred@s-mail.com> writes:
> Upon invoking a polygon(integer, circle) function a
> src/backend/utils/adt/geo_ops.c:circle_poly() function will gets
> called, which suffers from a buffer overflow.
>
> 2) A src/backend/adt/utils/geo_ops.c:path_encode() fails to detect a
> buffer overrun condition. It is called in multiple places, the most
> interesting are path_out() and poly_out() functions.

> 5) A src/backend/utils/adt/geo_ops.c:path_add() also fails to detect
> a simple buffer overrun.

I've attached a patch which should fix these problems.

Neil Conway
2002-08-29 23:05:44 +00:00
Bruce Momjian f81ce4a0f6 Prevent problem with extra-long password packets from allocating lots of
memory.

Neil Conway
2002-08-29 21:50:36 +00:00
Bruce Momjian 626eca697c This patch reserves the last superuser_reserved_connections slots for
connections by the superuser only.

This patch replaces the last patch I sent a couple of days ago.

It closes a connection that has not been authorised by a superuser if it would
leave less than the GUC variable ReservedBackends
(superuser_reserved_connections in postgres.conf) backend process slots free
in the SISeg. This differs to the first patch which only reserved the last
ReservedBackends slots in the procState array. This has made the free slot
test more expensive due to the use of a lock.

After thinking about a comment on the first patch I've also made it a fatal
error if the number of reserved slots is not less than the maximum number of
connections.

Nigel J. Andrews
2002-08-29 21:02:12 +00:00
Tom Lane e4186762ff Adjust nodeFunctionscan.c to reset transient memory context between calls
to the table function, thus preventing memory leakage accumulation across
calls.  This means that SRFs need to be careful to distinguish permanent
and local storage; adjust code and documentation accordingly.  Patch by
Joe Conway, very minor tweaks by Tom Lane.
2002-08-29 17:14:33 +00:00
Tom Lane 0201dac1c3 Push down outer qualification clauses into UNION and INTERSECT subqueries.
Per pghackers discussion from back around 1-August.
2002-08-29 16:03:49 +00:00
Tom Lane d2236800ee Cause REINDEX to regard TOAST tables as regular relations, not system
tables that need special defenses.  I believe this is okay even for
TOAST tables that belong to system tables.
2002-08-29 15:56:20 +00:00
Tatsuo Ishii ed7baeaf4d Remove #ifdef MULTIBYTE per hackers list discussion. 2002-08-29 07:22:30 +00:00
Tom Lane 8e80dbb849 Rephrase 'Cannot insert into a view' and related messages, per
pghackers discussion around 31-Jul-02.
2002-08-29 06:05:27 +00:00
Tom Lane dc4e983ff6 Produce a somewhat-useful error message, namely
ERROR:  Cannot display a value of type RECORD
rather than a random integer when someone tries to SELECT a tuple
value.  Per pghackers discussion around 26-May-02.
2002-08-29 04:38:04 +00:00
Tom Lane 5241a6259f Remove support for version-0 FE/BE protocol, per pghackers discussion.
This breaks support for 6.2 or older client libraries.
2002-08-29 03:22:01 +00:00
Tom Lane 8a24a55c81 Fix ruleutils to dump column definition lists for anonymous record types
defined in the FROM clause.  From Joe Conway, with some tweaks.
2002-08-29 01:19:41 +00:00
Tom Lane 64505ed58b Code review for standalone composite types, query-specified composite
types, SRFs.  Not happy with memory management yet, but I'll commit these
other changes.
2002-08-29 00:17:06 +00:00
Peter Eisentraut 12f80d7c69 Initial Spanish translation from Karim Mribti <karim@inlosa.com> 2002-08-28 21:01:14 +00:00
Bruce Momjian 03d39ce080 Remove TIOGA files from CVS current; they remain in repositiry. 2002-08-28 20:55:23 +00:00
Bruce Momjian fbb1966cf3 This trivial patches fixes the error message returned by CREATE INDEX
when it finds an existing relation with the same name as the
to-be-created index.

Old error message:

nconway=# create table foo (a int);
CREATE TABLE
nconway=# create index foo on foo (a);
ERROR:  index named "foo" already exists

I replaced 'index' with 'relation' in the error message.

Neil Conway
2002-08-28 20:46:47 +00:00
Bruce Momjian 81dfa2ce43 backend where a statically sized buffer is written to. Most of these
should be pretty safe in practice, but it's probably better to be safe
than sorry.

I was actually looking for cases where NAMEDATALEN is assumed to be
32, but only found one. That's fixed too, as well as a few bits of
code cleanup.

Neil Conway
2002-08-28 20:46:24 +00:00
Bruce Momjian b60acaf568 The following small patch provides a couple of minor updates (against
CVS HEAD):

Amended "strings" regression test. TOAST tests now insert two values
with storage set to "external", to exercise properly the TOAST slice
routines which fetch only a subset of the chunks.

Changed now-misleading comment on AlterTableCreateToastTable in
tablecmds.c, because both columns of the index on a toast table are now
used.

John Gray
2002-08-28 20:18:29 +00:00
Bruce Momjian 6077db92c2 Allow FOR UPDATE to appear after LIMIT/OFFSET to match MySQL syntax and as
a more logical ordering.
2002-08-28 14:35:37 +00:00
Tom Lane 65a34e93c6 Bring comments back in sync with code. 2002-08-27 20:54:47 +00:00
Bruce Momjian 73b94657b0 Throw error on pg_atoi(''), regression adjustments. 2002-08-27 20:29:11 +00:00
Bruce Momjian a1c218cae4 The attached patch implements the password packet length sanity check
(using an elog(LOG) ), as well as includes a few more comment fixes.

Neil Conway
2002-08-27 16:21:51 +00:00
Bruce Momjian fd3c4b2eaf Add most of Neil Conway's cleanups. 2002-08-27 15:15:23 +00:00
Bruce Momjian 0582ad91ac Add fsm sizes. 2002-08-27 14:06:05 +00:00
Tom Lane 28e82066a1 PREPARE/EXECUTE statements. Patch by Neil Conway, some kibitzing
from Tom Lane.
2002-08-27 04:55:12 +00:00
Bruce Momjian a77d34f0b8 This patch updates the lock listing code to use Joe Conway's new
anonymous return type SRF code. It gets rid of the superflous
'pg_locks_result' that Bruce/Tom had commented on. Otherwise, no
changes in functionality.

Neil Conway
2002-08-27 04:00:28 +00:00
Bruce Momjian dd912c6977 This patches replaces a few more usages of strcpy() and sprintf() when
copying into a fixed-size buffer (in this case, a buffer of
NAMEDATALEN bytes). AFAICT nothing to worry about here, but worth
fixing anyway...

Neil Conway
2002-08-27 03:56:35 +00:00
Bruce Momjian c0ad595386 I attach a little patch to make CLUSTER set and reset the indisclustered
bit on the indexes.

I also attach clusterdb and clusterdb.sgml; both of them are blatant
rips of vacuumdb and vacuumdb.sgml, but get the job done.  Please review
them, as I'm probably making a lot of mistakes with SGML and I can't
compile it here.

vacuumdb itself is not very comfortable to use when the databases have
passwords, because it has to connect once for each table (I can probably
make it connect only once for each database; should I?).  Because of
this I added a mention of PGPASSWORDFILE in the documentation, but I
don't know if that is the correct place for that.

Alvaro Herrera
2002-08-27 03:38:28 +00:00
Bruce Momjian b7e272429c Add to skip list in check_guc 2002-08-27 03:06:16 +00:00
Bruce Momjian fd9d665908 Comment cleanup. 2002-08-27 03:02:31 +00:00
Bruce Momjian fc67e1fb94 Script cleanups. 2002-08-27 03:01:13 +00:00
Bruce Momjian f20ec2e8f8 Clean up script. 2002-08-27 02:54:39 +00:00
Bruce Momjian 1051346fb7 Add check_guc utility to compare guc.c and postgresql.conf.sample. 2002-08-27 02:52:42 +00:00
Bruce Momjian e46afb588d Fix units in postgresql.conf. 2002-08-27 02:50:41 +00:00
Bruce Momjian 9ede612245 Add units to postgresql.conf file. 2002-08-26 22:23:07 +00:00
Tom Lane 5d6758fd24 Increase WIDTH_THRESHOLD from 256 to 1K. This addresses recent observation
that ANALYZE would not gather any stats for a CHAR(255) column.  I still
think a width threshold is appropriate for the reasons mentioned in the
code, but we can loosen it at least.
2002-08-26 18:45:57 +00:00
Tom Lane 5cabcfccce Modify array operations to include array's element type OID in the
array header, and to compute sizing and alignment of array elements
the same way normal tuple access operations do --- viz, using the
tupmacs.h macros att_addlength and att_align.  This makes the world
safe for arrays of cstrings or intervals, and should make it much
easier to write array-type-polymorphic functions; as examples see
the cleanups of array_out and contrib/array_iterator.  By Joe Conway
and Tom Lane.
2002-08-26 17:54:02 +00:00
Bruce Momjian 39e331be72 Add Bob Devine's name to the optimizer README. 2002-08-25 22:39:37 +00:00
Tom Lane 58de480999 Clean up comments to be careful about the distinction between variable-
width types and varlena types, since with the introduction of CSTRING as
a more-or-less-real type, these concepts aren't identical.  I've tried to
use varlena consistently to denote datatypes with typlen = -1, ie, they
have a length word and are potentially TOASTable; while the term variable
width covers both varlena and cstring (and, perhaps, someday other types
with other rules for computing the actual width).  No code changes in this
commit except for renaming a couple macros.
2002-08-25 17:20:01 +00:00
Tom Lane 976246cc7e The cstring datatype can now be copied, passed around, etc. The typlen
value '-2' is used to indicate a variable-width type whose width is
computed as strlen(datum)+1.  Everything that looks at typlen is updated
except for array support, which Joe Conway is working on; at the moment
it wouldn't work to try to create an array of cstring.
2002-08-24 15:00:47 +00:00
Tom Lane a2a3192802 Further cleanup around the edges of OPAQUE/pseudotype changes. Correct
the declarations of some index access method support functions.  Support
SQL functions returning VOID.
2002-08-23 16:41:38 +00:00
Tom Lane 0f1112923c Code review for recent TRUNCATE changes. Tighten relation-kind check,
tighten foreign-key check (a self-reference should not prevent TRUNCATE),
improve error message, cause a relation's TOAST table to be truncated
along with the relation.
2002-08-22 14:23:36 +00:00
Bruce Momjian b4f24fed7a Commit updated repeat() patch, from Neil Conway 2002-08-22 05:05:19 +00:00
Bruce Momjian d86dee3edd This patch should fix the problem. Doesn't include my previous patch
for repeat(). Again, somewhat off-the-cuff, so I might have missed
something...

test=# select lpad('xxxxx',1431655765,'yyyyyyyyyyyyyyyy');
ERROR:  Requested length too large
test=# select rpad('xxxxx',1431655765,'yyyyyyyyyyyyyyyy');
ERROR:  Requested length too large

(That's on a Unicode DB, haven't tested other encodings but AFAICT
this fix should still work.)

Neil Conway
2002-08-22 04:55:05 +00:00
Bruce Momjian cbe733d752 repeat() fix:
> Neil Conway <neilc@samurai.com> writes:
> > +   /* Check for integer overflow */
> > +   if (tlen / slen != count)
> > +           elog(ERROR, "Requested buffer is too large.");
>
> What about slen == 0?

Good point -- that wouldn't cause incorrect results or a security
problem, but it would reject input that we should really accept.

Revised patch is attached.

Neil Conway
2002-08-22 04:54:20 +00:00
Bruce Momjian 47b37a6bfa # Disallow TRUNCATE on tables that are involved in referential
constraints


The issue with finding and removing foreign key constraints is no longer
an issue, so please apply the attached.

It does NOT check for rules or on delete triggers (old style foreign
keys) as those are difficult to deal with (remove, truncate, re-add).

Rod Taylor
2002-08-22 04:51:06 +00:00
Bruce Momjian a334ae3f22 As suggested by Tom, this patch restricts the right-hand argument of
bytealike to TEXT.

This leaves like_escape_bytea() without anything to do, but I left it in
place in anticipation of the eventual bytea pattern selectivity
functions. If there is agreement that this would be the best long term
solution, I'll take it as a TODO for 7.4.

Joe Conway
2002-08-22 04:45:11 +00:00
Bruce Momjian 89260124db Add:
replace(string, from, to)
   -- replaces all occurrences of "from" in "string" to "to"
split(string, fldsep, column)
   -- splits "string" on "fldsep" and returns "column" number piece
to_hex(int32_num) & to_hex(int64_num)
   -- takes integer number and returns as hex string

Joe Conway
2002-08-22 03:24:01 +00:00
Bruce Momjian ff1793f036 Remove erroneous character from Makefile due to editor error. 2002-08-22 02:18:45 +00:00
Tom Lane b663f3443b Add a bunch of pseudo-types to replace the behavior formerly associated
with OPAQUE, as per recent pghackers discussion.  I still want to do some
more work on the 'cstring' pseudo-type, but I'm going to commit the bulk
of the changes now before the tree starts shifting under me ...
2002-08-22 00:01:51 +00:00
Bruce Momjian d46e3dc00f Changes made so new conversion Makefiles will build out of the source tree. 2002-08-21 21:33:55 +00:00
Peter Eisentraut 41c92ace2f Move PO files into subdirectories separate from the source code. 2002-08-21 20:42:27 +00:00
Tom Lane 0d6f613817 Increase buffer size in cash_words(). Pure paranoia; I don't think the
code is broken, but any small change in the output format might overrun
the buffer with the old size.
2002-08-20 16:46:29 +00:00
Bruce Momjian 5243f9a998 Allow pg_statistics to be reset by calling pg_stat_reset().
Christopher Kings-Lynne
2002-08-20 04:47:52 +00:00
Bruce Momjian de9801fc62 Add current_database().
> Quick system function to pull out the current database.
>
> I've used this a number of times to allow stored procedures to find out
> where they are.  Especially useful for those that do logging or hit a
> remote server.
>
> It's called current_database() to match with current_user().

It's also a necessity for an informational schema.  The catalog
(database) name is required in a number of places.

Rod Taylor
2002-08-20 04:46:00 +00:00
Tom Lane a0bf1a7f2e Fix pg_dump to dump serial columns as serials. Per pghackers discussion,
cause SERIAL column declaration not to imply UNIQUE, so that this can be
done without creating an extra index.
2002-08-19 19:33:36 +00:00
Tom Lane 6ebc90b045 Remove Ident nodetype in favor of using String nodes; this fixes some
latent wrong-struct-type bugs and makes the coding style more uniform,
since the majority of places working with lists of column names were
already using Strings not Idents.  While at it, remove vestigial
support for Stream node type, and otherwise-unreferenced nodes.h entries
for T_TupleCount and T_BaseNode.
NB: full recompile is recommended due to changes of Node type numbers.
This shouldn't force an initdb though.
2002-08-19 15:08:47 +00:00
Tatsuo Ishii 10b374aecf Fix bug in pg_convert() per report from MaC.Yui.
It pfree() wrong pointer.
2002-08-19 04:08:08 +00:00
Tom Lane f4ad5e8d18 Clean up leftover bugs from recent COPY feature patch --- missed
required changes to copyfuncs/equalfuncs.
2002-08-19 00:40:15 +00:00
Tom Lane 5f6a27f8f9 Add missing copyfuncs/equalfuncs entries, including T_Null which has
been missing forever; surprising it wasn't noticed before.  The other
additions are, um, sloppiness in certain recent feature additions.
2002-08-19 00:11:53 +00:00
Tom Lane 22bfa72068 Remove optimization whereby parser would make only one sort-list entry
when two equal() targetlist items were to be added to an ORDER BY or
DISTINCT list.  Although indeed this would make sorting fractionally
faster by sometimes saving a comparison, it confuses the heck out of
later stages of processing, because it makes it look like the user
wrote DISTINCT ON rather than DISTINCT.  Bug reported by joe@piscitella.com.
2002-08-18 18:46:15 +00:00
Peter Eisentraut 315a9ca32e Make CREATE CONSTRAINT TRIGGER check for REFERENCES privilege on both
master and slave tables.
2002-08-18 11:20:05 +00:00
Peter Eisentraut c828ec8820 Make pg_dump output more portable and more pleasing to look at.
The -n and -N options were removed.  Quoting is now smart enough to
supply quotes if and only if necessary.

Numerical types are now printed without quotes, except in cases of
special values such as NaN.

Boolean values printed as true and false.

Most string literals now do not escape whitespace characters (newlines,
etc.) for portability.

SET SESSION AUTHORIZATION argument is a string literal, to follow SQL.

Made commands output by pg_dump use consistent spacing and indentation.
2002-08-18 09:36:26 +00:00
Tom Lane 2efb8e8070 Code review for 'at character n' patch --- point at proper end of
a token scanned by multiple lex rules.
2002-08-18 03:35:08 +00:00
Bruce Momjian 2c6b34d959 Add db-local user names, per discussion on hackers. 2002-08-18 03:03:26 +00:00
Bruce Momjian d04e9137c9 Reverse out XLogDir/-X write-ahead log handling, per discussion.
Original patch from Thomas.
2002-08-17 15:12:07 +00:00
Bruce Momjian fc68e44062 Add lock file. 2002-08-17 13:11:43 +00:00
Bruce Momjian 54124240ae In that case, attached is a patch which locates the beginning of the
offending token more efficiently (per your suggestion of using
scanbuf). The new patch does the same as before:

template1=# select * frum pg_class;
ERROR:  parser: parse error at or near "frum" at character 10

It also implement's Tom's suggestion:

template1=# select * from pg_class where\g
ERROR:  parse: parse error at end of input

Gavin Sherry
2002-08-17 13:06:50 +00:00
Bruce Momjian 82119a696e [ Newest version of patch applied.]
This patch is an updated version of the lock listing patch. I've made
the following changes:

    - write documentation
    - wrap the SRF in a view called 'pg_locks': all user-level
      access should be done through this view
    - re-diff against latest CVS

One thing I chose not to do is adapt the SRF to use the anonymous
composite type code from Joe Conway. I'll probably do that eventually,
but I'm not really convinced it's a significantly cleaner way to
bootstrap SRF builtins than the method this patch uses (of course, it
has other uses...)

Neil Conway
2002-08-17 13:04:19 +00:00
Bruce Momjian b813554dbd Improve documentation of trigger firing queue handling, cleanup.
Neil Conway
2002-08-17 12:15:49 +00:00
Tom Lane a208ea72bc Modify pg_dump to dump foreign-key constraints as constraints, not as
sets of triggers.  Also modify psql \d command to show foreign key
constraints as such and hide the triggers.  pg_get_constraintdef()
function added to backend to support these.  From Rod Taylor, code
review and some editorialization by Tom Lane.
2002-08-16 23:01:21 +00:00
Tom Lane ad7d3bddea Make domain types indexable. Rod Taylor & Tom Lane. 2002-08-16 20:55:09 +00:00
Bruce Momjian b1a5f87209 Tom Lane wrote:
> There's no longer a separate call to heap_storage_create in that routine
> --- the right place to make the test is now in the storage_create
> boolean parameter being passed to heap_create.  A simple change, but
> it passeth patch's understanding ...

Thanks.

Attached is a patch against cvs tip as of 8:30 PM PST or so. Turned out
that even after fixing the failed hunks, there was a new spot in
bufmgr.c which needed to be fixed (related to temp relations;
RelationUpdateNumberOfBlocks). But thankfully the regression test code
caught it :-)

Joe Conway
2002-08-15 16:36:08 +00:00
Bruce Momjian db147006c1 Backed out. It is part of a later patch. 2002-08-15 03:04:07 +00:00
Bruce Momjian 46aaa5dda3 Appears there is a problem finding the opclass when indexing a domain.
CREATE DOMAIN newint as int4;
CREATE TABLE tab (col newint unique);
ERROR:  data type newint has no default operator class for access method
"btree"
        You must specify an operator class for the index or define a
        default operator class for the data type


Specifically, GetDefaultOpClass() finds 0 exact matches and 3 binary
compatible matches.  Fetching getBaseType() of the attribute fixes the
problem for domains (see attachment).

Rod Taylor
2002-08-15 02:53:35 +00:00
Bruce Momjian 45e2544584 As discussed on several occasions previously, the new anonymous
composite type capability makes it possible to create a system view
based on a table function in a way that is hopefully palatable to
everyone. The attached patch takes advantage of this, moving
show_all_settings() from contrib/tablefunc into the backend (renamed
all_settings(). It is defined as a builtin returning type RECORD. During
initdb a system view is created to expose the same information presently
available through SHOW ALL. For example:

test=# select * from pg_settings where name like '%debug%';
          name          | setting
-----------------------+---------
  debug_assertions      | on
  debug_pretty_print    | off
  debug_print_parse     | off
  debug_print_plan      | off
  debug_print_query     | off
  debug_print_rewritten | off
  wal_debug             | 0
(7 rows)


Additionally during initdb two rules are created which make it possible
to change settings by updating the system view -- a "virtual table" as
Tom put it. Here's an example:

Joe Conway
2002-08-15 02:51:27 +00:00
Tom Lane dc8705531d Really truly enable encrypted passwords by default. 2002-08-14 23:02:59 +00:00
Bruce Momjian b20f80f0b3 Enable encrypted passwords by default. 2002-08-14 22:07:56 +00:00
Tatsuo Ishii 538b101595 Fix memory leak in SetClientEncoding(). 2002-08-14 05:33:34 +00:00
Tatsuo Ishii 969e0246ed Add Cyrillic and other encodings for encoding conversion.
Patches submitted by Kaori Inaba (i-kaori@sra.co.jp).
2002-08-14 02:45:10 +00:00
Tom Lane f8b4a2e0f0 Fix tuple-chain-moving tests to handle marked-for-update tuples correctly
(they are not part of a chain).  When failing to find a parent tuple in
an update chain, emit a warning and abandon repair_frag, but do not give
an error as before.  This should eliminate the infamous 'No one parent tuple
was found' failure, which we now realize is not a can't-happen condition
but a perfectly valid database state.  Per recent pghackers discussion.
2002-08-13 20:14:24 +00:00
Tom Lane 0affc29e1e Make sure that t_ctid is reset to equal t_self in heap_delete and
heap_mark4update; this avoids situations where a deleted tuple might
look like it is chained to something else.  Also, cause all the WAL
redo routines to set t_ctid to equal t_self, rather than leaving it
undefined as before.  Make heap_xlog_clean set the page's LSN and SUI
correctly.  All per past discussions in pghackers, ranging back to
last December.
2002-08-13 20:11:03 +00:00
Peter Eisentraut 1e4c4f9eb7 Remove obsolete uses of lanispl. Only used in pg_dump now, but can be
removed altogether if pg_dump doesn't need it anymore.
2002-08-13 17:22:08 +00:00
Tom Lane 1ccc2451c6 Convert possibly-unsafe sprintf's to snprintf's. 2002-08-12 14:47:46 +00:00
Tom Lane 77a7e9968b Change memory-space accounting mechanism in tuplesort.c and tuplestore.c
to make a reasonable attempt at accounting for palloc overhead, not just
the requested size of each memory chunk.  Since in many scenarios this
will make for a significant reduction in the amount of space acquired,
partially compensate by doubling the default value of SORT_MEM to 1Mb.
Per discussion in pgsql-general around 9-Jun-2002..
2002-08-12 00:36:12 +00:00
Tom Lane e44beef712 Code review of CLUSTER patch. Clean up problems with relcache getting
confused, toasted data getting lost, etc.
2002-08-11 21:17:35 +00:00
Peter Eisentraut 9bccdf17f7 Create/drop cast now requires ownership of at least one of the types. 2002-08-11 17:44:12 +00:00
Tom Lane 13e838f1d9 Neil's patch was supposed to remove this, too. 2002-08-11 00:18:59 +00:00
Tom Lane 2e10863bf5 Now that we allow ANALYZE to run inside a transaction block, the locks
it takes could be held for quite awhile after the analyze step completes.
Rethink locking of pg_statistic in light of this fact.  The original
scheme took an exclusive lock on pg_statistic, which was okay when the
lock could be expected to be released shortly, but that doesn't hold
anymore.  Back off to a normal writer's lock (RowExclusiveLock).  This
allows concurrent ANALYZE of nonoverlapping sets of tables, at the price
that concurrent ANALYZEs of the same table may fail with 'tuple
concurrently updated'.
2002-08-11 00:08:48 +00:00
Bruce Momjian d1c6416223 Update with newer version of CLUSTER patch posted August 8.
> Looks like Alvaro got sideswiped by the system catalog indexing changes
> I made over the weekend.  It's a simple change, just reduce the whole
> mess to a "CatalogUpdateIndexes()" call.

I update two tuples, so I manually CatalogOpenIndexes() and
CatalogIndexInsert() two times, as per comments in
CatalogUpdateIndexes().

I also removed a couple of useless CommandCounterIncrement(), some
useless definitions in src/include/commands/cluster.h and useless
includes in src/backend/commands/cluster.c.  This version passes the
regression test I had made for previous versions.

Alvaro Herrera
2002-08-10 21:00:34 +00:00
Bruce Momjian 0d916a4b60 > create view pg_locks as select l.relation, l.database, l.backendpid,
> l.mode, l.isgranted from pg_lock_info() as l(relation oid, database oid,
 > backendpid int4, mode text, isgranted bool);
 > ERROR:  badly formatted planstring "COLUMNDEF "...
 >

Reported by Neil Conway -- I never implemented readfuncs.c support for
ColumnDef or TypeName, which is needed so that views can be created on
functions returning type RECORD. Here's a patch.

Joe Conway
2002-08-10 20:44:48 +00:00
Bruce Momjian 7dc40a2be0 Major improvement in CLUSTER which preserves table characteristics using
relfilenode.

I sent the CLUSTER patch a few days ago and I think it was missed.  I
append it again, this time including the regression test files.  For the
committer, please note that you have to cvs add the files as they don't
exist.  Maybe add to the parallel and serial schedules also, but I don't
know such stuff.

Alvaro Herrera (<alvherre[a]atentus.com>)
2002-08-10 20:43:46 +00:00