Commit Graph

5113 Commits

Author SHA1 Message Date
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
Bruce Momjian c5354dff20 This patch removes a lot of unused code related to assertions and
error handling, and simplifies the code that remains. Apparently,
the code that left Berkeley had a whole "error handling subsystem",
which exceptions and whatnot. Since we don't use that anymore,
there's no reason to keep it around.

The regression tests pass with the patch applied. Unless anyone
sees a problem, please apply.

Neil Conway
2002-08-10 20:29:18 +00:00
Tom Lane a5e6e99357 Allow schema-qualified operator names to be used in the optional
arguments of CREATE OPERATOR.
2002-08-10 19:01:53 +00:00
Peter Eisentraut f1d820494c Fix failure to relink postmaster executable in the first make run if only a
single source file a few directories deep in the backend tree has changed.
2002-08-10 17:59:28 +00:00
Peter Eisentraut 6ce4a4e3e1 Make sure monetary, numeric, and time locale categories are set to C and
are only activated temporarily to read out formatting information.
2002-08-09 22:52:04 +00:00
Tom Lane 4ab8e69094 has_table_privilege spawns scions has_database_privilege, has_function_privilege,
has_language_privilege, has_schema_privilege to let SQL queries test
all the new privilege types in 7.3.  Also, add functions pg_table_is_visible,
pg_type_is_visible, pg_function_is_visible, pg_operator_is_visible,
pg_opclass_is_visible to test whether objects contained in schemas are
visible in the current search path.  Do some minor cleanup to centralize
accesses to pg_database, as well.
2002-08-09 16:45:16 +00:00
Tom Lane 9459db8ea9 Cause view/rule display to work as expected after rename of an underlying
table or column, or of an output column of the view itself.
2002-08-08 17:00:19 +00:00
Tatsuo Ishii 697b472099 Address build problems on cygwin and (hopefully) AIX. 2002-08-08 07:47:43 +00:00
Tatsuo Ishii 3c63578a7e Load and keep conversion function info when SET CLIENT_ENCODING TO is
executed to prevent database access while performing encoding
conversion.
2002-08-08 06:35:26 +00:00