Commit Graph

225 Commits

Author SHA1 Message Date
Tom Lane 18f58a048e Preliminary code review for C version of initdb. Re-centralize handling
of option switches for backend, fix handling of COPY from data files so
that we won't have the newline-after-\. issue back again, add back some
comments and printouts lost from the shell script, etc.  Still needs work
for error handling; in particular the shell version worked much more
nicely for the case of a postgres executable that fails on invocation.
2003-11-13 23:46:31 +00:00
Tom Lane c7bfc7df0a Silly to copy sprompt.c from src/port when we're linking libpgport anyway. 2003-11-13 20:30:37 +00:00
Bruce Momjian 90823299ad pgindent new initdb.c from Tom. 2003-11-13 20:12:47 +00:00
Bruce Momjian ad89c2ae25 Add owner description to initdb C code.
Andrew Dunstan
2003-11-13 15:01:40 +00:00
Tom Lane 9a9890d842 Add fflush() calls so that I'm-about-to-do-this messages actually
come out before the action is done.
2003-11-13 01:36:00 +00:00
Tom Lane 88dd65ae9f Fix lack of optreset. 2003-11-13 01:09:24 +00:00
Bruce Momjian 1060c4c4c4 Move system_views.sql into backend/catalog, per Tom. 2003-11-11 01:58:23 +00:00
Bruce Momjian 0ca6939c10 Updated version of initdb with "rmdir/del" call on Win32.
Other cleanups as discussed.
2003-11-10 22:52:10 +00:00
Bruce Momjian 279598bb71 Add C version of initdb, from Andrew Dunstan.
This is his original version with a binary rmdir() we might need in the
future.

I will commit an update version with cleanups shortly.
2003-11-10 22:51:16 +00:00
Tom Lane 87299583a5 Determine max_connections first, then see how large shared_buffers can
be made, to avoid corner cases where max_connections ends up unreasonably
small because shared_buffers is hogging too much shmem space.  Per pghackers
discussion about a week ago.  Also, fix the copy-newlines problem in a
more robust way, by using COPY FROM filename instead of COPY FROM STDIN;
per a suggestion from Peter.
2003-10-13 21:06:44 +00:00
Bruce Momjian e349584d5d Make dump files created by initdb have consistent EOL termination, to
pass COPY's EOL tests.
2003-09-27 16:27:57 +00:00
Peter Eisentraut 4af19a579d The formatting of the display of the locale names assumed that locale names
are not longer than 8 characters.  But sometimes they are, and that made
the display quite ugly.  So just format them vertically so that everyone
can read them.
2003-09-27 09:21:26 +00:00
Tom Lane 7703e55c32 Make the default pg_hba.conf include an entry for ::1 only if configure
set HAVE_IPV6.  Per recent discussions.
2003-09-07 03:36:03 +00:00
Tom Lane f63cbccac7 Mop-up for previous change to determine default shared_buffers and
max_connections at initdb time.  Get rid of DEF_NBUFFERS and DEF_MAXBACKENDS
macros, which aren't doing anything useful anymore, and put more likely
defaults into postgresql.conf.sample.
2003-08-26 15:38:25 +00:00
Bruce Momjian 38fb906f93 > Joe Conway <mail@joeconway.com> writes:
>>ISTM that "source" is worth knowing.
>
> Hm, possibly.  Any other opinions?

This version has the seven fields I proposed, including "source". Here's
an example that shows why I think it's valuable:

regression=# \x
Expanded display is on.
regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | on
context | user
vartype | bool
source  | default
min_val |
max_val |

regression=# update pg_settings set setting = 'off' where name =
'enable_seqscan';
-[ RECORD 1 ]---
set_config | off

regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | off
context | user
vartype | bool
source  | session
min_val |
max_val |

regression=# alter user postgres set enable_seqscan to 'off';
ALTER USER

(log out and then back in again)

regression=# \x
Expanded display is on.
regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | off
context | user
vartype | bool
source  | user
min_val |
max_val |

In the first case, enable_seqscan is set to its default value. After
setting it to off, it is obvious that the value has been changed for the
session only. In the third case, you can see that the value has been set
specifically for the user.

Joe Conway
2003-07-27 04:35:54 +00:00
Peter Eisentraut c154fc3a20 Apply message style guide to frontend programs. 2003-07-23 08:47:41 +00:00
Bruce Momjian 0fe252b5da Don't report sequendces in pg_tables. 2003-07-22 00:02:55 +00:00
Bruce Momjian 82f18c4a2c Fix relkind test for pg_tables.
Mike Quinn
2003-07-21 15:20:27 +00:00
Tom Lane 9117e55493 Tweak original coding so that we can determine the platform-specific
shared_buffers and max_connections values to use before we run the
bootstrap process.  Without this, initdb would fail on platforms where
the hardwired default values are too large.  (We could get around that
by making the hardwired defaults tiny, perhaps, but why slow down
bootstrap by starving it for buffers...)
2003-07-15 00:11:14 +00:00
Tom Lane de98a7e23a The default values for shared_buffers and max_connections are now 1000
and 100 respectively, if the platform will allow it.  initdb selects
values that are not too large to allow the postmaster to start, and
places these values in the installed postgresql.conf file.  This allows
us to continue to start up out-of-the-box on platforms with small SHMMAX,
while having somewhat-realistic default settings on platforms with
reasonable SHMMAX.  Per recent pghackers discussion.
2003-07-14 20:00:23 +00:00
Tom Lane b700a672fe Add --help-config facility to dump information about GUC parameters
without needing a running backend.  Reorder postgresql.conf.sample
to match new layout of runtime.sgml.  This commit re-adds work lost
in Wednesday's crash.
2003-07-04 16:41:22 +00:00
Tom Lane 5369190220 Make the world at least marginally safe for usernames with embedded spaces.
Per recent gripe.
2003-06-02 19:00:29 +00:00
Tom Lane 4df52b28f0 Fix things so that an error occuring during standalone-backend processing
in initdb will result in exit(1), allowing the initdb script to realize
that there's something wrong.
2003-05-28 18:19:09 +00:00
Tom Lane aae078198d In bootstrap and standalone-backend modes, do not sort LOG elevel out
of order; the 'server log' output is actually client output in these
scenarios and we ought to treat elevels the same way as in the client
case.  This allows initdb to not send backend stderr to /dev/null anymore,
which makes it much more likely that people will notice problems during
initdb.
2003-05-28 17:25:02 +00:00
Peter Eisentraut 2c0556068f Indexing support for pattern matching operations via separate operator
class when lc_collate is not C.
2003-05-15 15:50:21 +00:00
Tom Lane 3b4ca4c0d9 Code review for pg_stat_get_backend_activity_start patch --- fix
return type, make protection condition agree with recent change to
pg_stat_get_backend_activity, clean up documentation.
2003-04-04 03:03:54 +00:00
Peter Eisentraut 5e5c5cd31a Merge documentation into one book. (Build with "make html".) Replace
vague cross-references with real links.
2003-03-25 16:15:44 +00:00
Bruce Momjian a18331004a Add start time to pg_stat_activity
Neil Conway
2003-03-20 03:34:57 +00:00
Peter Eisentraut 8cb041aada Set up the privileges on the default schemas in initdb with real GRANT
commands, to arrive at a valid and dumpable state.
2003-03-19 16:08:59 +00:00
Bruce Momjian 69c049cef4 Back out LOCKTAG changes by Rod Taylor, pending code review. Sorry. 2003-02-19 23:41:15 +00:00
Bruce Momjian d0f3a7e9c4 - Modifies LOCKTAG to include a 'classId'. Relation receive a classId of
RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed
to objId.

- LockObject() and UnlockObject() functions created, and their use
sprinkled throughout the code to do descent locking for domains and
types. They accept lock modes AccessShare and AccessExclusive, as we
only really need a 'read' and 'write' lock at the moment.  Most locking
cases are held until the end of the transaction.

This fixes the cases Tom mentioned earlier in regards to locking with
Domains.  If the patch is good, I'll work on cleaning up issues with
other database objects that have this problem (most of them).

Rod Taylor
2003-02-19 04:02:54 +00:00
Peter Eisentraut ef7422510e Grant options, and cascading revoke. Grant options are allowed only for
users right now, not groups.  Extension of has_foo_privileges functions to
query the grant options.  Extension of aclitem type to store grantor.
2003-01-23 23:39:07 +00:00
Peter Eisentraut 980acc8329 Fix sed expression for BSD sed. 2003-01-21 10:11:52 +00:00
Peter Eisentraut 828822bc96 Add remaining documentation tables to information schema. 2003-01-15 23:37:28 +00:00
Peter Eisentraut 2160c9177d Add sql_features table to information schema. Generate the features list
in the documentation from that same data.
2003-01-14 23:19:34 +00:00
Peter Eisentraut 1b42ad7e59 Initial version of the SQL information schema 2002-12-14 00:24:35 +00:00
Bruce Momjian 9645fa8ccd Remove check for pg_group file as part of initdb -W password assignment
--- not needed.
2002-11-25 21:41:46 +00:00
Peter Eisentraut 4cff161703 Improve formatting of --help output. 2002-10-18 22:05:36 +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
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
Tom Lane 5b69f695ac Seems like a good idea for template1 to contain ANALYZE stats for the
system tables.
2002-09-05 19:56:57 +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 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
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 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 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 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 3b78826bb5 Make the standard system views schema-aware.
I did not force an initdb via catversion ... but the rules
regression test will fail until you do an initdb.
2002-08-08 19:39:05 +00:00
Thomas G. Lockhart af704cdfb4 Implement WAL log location control using "-X" or PGXLOG. 2002-08-04 06:26:38 +00:00