Commit Graph

2864 Commits

Author SHA1 Message Date
Heikki Linnakangas 83c3121403 Fix pg_dump bug in the database-level collation patch. "datcollate" and
"datctype" columns were misspelled. Per report from Chris Browne.
2008-09-24 19:33:15 +00:00
Magnus Hagander 660ad48d3b Silence compiler warning caused by recent collation patch. 2008-09-24 09:00:44 +00:00
Magnus Hagander 607b7166d8 Make sure pg_control is opened in binary mode, to deal
with situtations when the file contains an EOF maker
(0x1A) on Windows.

ITAGAKI Takahiro
2008-09-24 08:59:42 +00:00
Heikki Linnakangas c2d4526495 Tighten the check in initdb and CREATE DATABASE that the chosen encoding
matches the encoding of the locale. LC_COLLATE is now checked in addition
to LC_CTYPE.
2008-09-23 10:58:03 +00:00
Heikki Linnakangas 61d9674988 Make LC_COLLATE and LC_CTYPE database-level settings. Collation and
ctype are now more like encoding, stored in new datcollate and datctype
columns in pg_database.

This is a stripped-down version of Radek Strnad's patch, with further
changes by me.
2008-09-23 09:20:39 +00:00
Peter Eisentraut b850cf61bd Avoid compiler warning about variable used before assigned. 2008-09-15 12:18:00 +00:00
Tom Lane bc01b45ab9 Make pg_dump --data-only try to order the table dumps so that foreign keys'
referenced tables are dumped before the referencing tables.  This avoids
failures when the data is loaded with the FK constraints already active.
If no such ordering is possible because of circular or self-referential
constraints, print a NOTICE to warn the user about it.
2008-09-08 15:26:23 +00:00
Tom Lane a0b76dc662 Create a separate grantable privilege for TRUNCATE, rather than having it be
always owner-only.  The TRUNCATE privilege works identically to the DELETE
privilege so far as interactions with the rest of the system go.

Robert Haas
2008-09-08 00:47:41 +00:00
Tom Lane 409c144d83 Adjust psql's new \ef command to present an empty CREATE FUNCTION template
for editing if no function name is specified.  This seems a much cleaner way
to offer that functionality than the original patch had.  In passing,
de-clutter the error displays that are given for a bogus function-name
argument, and standardize on "$function$" as the default delimiter for the
function body.  (The original coding would use the shortest possible
dollar-quote delimiter, which seems to create unnecessarily high risk of
later conflicts with the user-modified function body.)
2008-09-06 20:18:08 +00:00
Tom Lane 2c863ca818 Implement a psql command "\ef" to edit the definition of a function.
In support of that, create a backend function pg_get_functiondef().
The psql command is functional but maybe a bit rough around the edges...

Abhijit Menon-Sen
2008-09-06 00:01:25 +00:00
Bruce Momjian 2cdcf459ba Add comment about why pg_dump doesn't dump the public schema comment. 2008-09-05 23:53:42 +00:00
Alvaro Herrera 7ad60b49dc Fixup pg_dumpall adding --lock-wait-timeout, to match pg_dump.
David Gould
2008-08-29 17:28:43 +00:00
Alvaro Herrera c67f037f4f Document that \t and \x are now settable. 2008-08-29 15:52:07 +00:00
Tom Lane 7ee27d49df Fix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec
returns NULL instead of a PGresult.  The former coding would fail, which
is OK, but it neglected to give you the PQerrorMessage that might tell
you why.  In the oldest branches, there was another problem: it'd sometimes
report PQerrorMessage from the wrong connection.
2008-08-16 02:25:06 +00:00
Tom Lane 63c3b9903b Fix a couple of places where psql might fail to report a suitable error
if PQexec returns NULL.  These don't seem significant enough to be worth
back-patching, but they ought to get fixed ...
2008-08-16 01:36:35 +00:00
Bruce Momjian 21cf022fa9 Fix version warning bug in recently applied adjustments to psql startup.
Gregory Stark
2008-08-16 00:16:56 +00:00
Magnus Hagander 70d756970b Move pgstat.tmp into a temporary directory under $PGDATA named pg_stat_tmp.
This allows the use of a ramdrive (either through mount or symlink) for
the temporary file that's written every half second, which should
reduce I/O.

On server shutdown/startup, the file is written to the old location in
the global directory, to preserve data across restarts.

Bump catversion since the $PGDATA directory layout changed.
2008-08-05 12:09:30 +00:00
Tom Lane 7df49cef72 Flip the default typispreferred setting from true to false. This affects
only type categories in which the previous coding made *every* type
preferred; so there is no change in effective behavior, because the function
resolution rules only do something different when faced with a choice
between preferred and non-preferred types in the same category.  It just
seems safer and less surprising to have CREATE TYPE default to non-preferred
status ...
2008-07-30 19:35:13 +00:00
Tom Lane bac3e83622 Replace the hard-wired type knowledge in TypeCategory() and IsPreferredType()
with system catalog lookups, as was foreseen to be necessary almost since
their creation.  Instead put the information into two new pg_type columns,
typcategory and typispreferred.  Add support for setting these when
creating a user-defined base type.

The category column is just a "char" (i.e. a poor man's enum), allowing
a crude form of user extensibility of the category list: just use an
otherwise-unused character.  This seems sufficient for foreseen uses,
but we could upgrade to having an actual category catalog someday, if
there proves to be a huge demand for custom type categories.

In this patch I have attempted to hew exactly to the behavior of the
previous hardwired logic, except for introducing new type categories for
arrays, composites, and enums.  In particular the default preferred state
for user-defined types remains TRUE.  That seems worth revisiting, but it
should be done as a separate patch from introducing the infrastructure.
Likewise, any adjustment of the standard set of categories should be done
separately.
2008-07-30 17:05:05 +00:00
Tom Lane 673a30fbb2 Add a pg_dump option --lock-wait-timeout to allow failing the dump if unable
to acquire shared table locks within a specified amount of time.

David Gould
2008-07-20 18:43:30 +00:00
Bruce Momjian b133ceb77d Revert patch so .psqlrc can suppress startup banner:
In psql, run .psqlrc _after_ printing warnings and banner.
2008-07-20 06:08:38 +00:00
Tom Lane 4b362c662e Avoid substituting NAMEDATALEN, FLOAT4PASSBYVAL, and FLOAT8PASSBYVAL into
the postgres.bki file during build, because we want that file to be entirely
platform- and configuration-independent; else it can't safely be put into
/usr/share on multiarch machines.  We can do the substitution during initdb,
instead.  FLOAT4PASSBYVAL and FLOAT8PASSBYVAL are new breakage as of 8.4,
while the NAMEDATALEN hazard has been there all along but I guess no one
tripped over it.  Noticed while trying to build "universal" OS X binaries.
2008-07-19 04:01:29 +00:00
Bruce Momjian 25c9de4d84 In psql, run .psqlrc _after_ printing warnings and banner. 2008-07-18 17:19:55 +00:00
Tom Lane a4775a80fd Suppress compiler warning, and not incidentally make the code more
robust.  The previous coding was quite risky because it was testing
conditions different from 'is the array really allocated?'.
2008-07-18 04:20:24 +00:00
Tom Lane 69a785b8bf Implement SQL-spec RETURNS TABLE syntax for functions.
(Unlike the original submission, this patch treats TABLE output parameters
as being entirely equivalent to OUT parameters -- tgl)

Pavel Stehule
2008-07-18 03:32:53 +00:00
Tom Lane 6563e9e2e8 Add a "provariadic" column to pg_proc to eliminate the remarkably expensive
need to deconstruct proargmodes for each pg_proc entry inspected by
FuncnameGetCandidates().  Fixes function lookup performance regression
caused by yesterday's variadic-functions patch.

In passing, make pg_proc.probin be NULL, rather than a dummy value '-',
in cases where it is not actually used for the particular type of function.
This should buy back some of the space cost of the extra column.
2008-07-16 16:55:24 +00:00
Tom Lane d89737d31c Support "variadic" functions, which can accept a variable number of arguments
so long as all the trailing arguments are of the same (non-array) type.
The function receives them as a single array argument (which is why they
have to all be the same type).

It might be useful to extend this facility to aggregates, but this patch
doesn't do that.

This patch imposes a noticeable slowdown on function lookup --- a follow-on
patch will fix that by adding a redundant column to pg_proc.

Pavel Stehule
2008-07-16 01:30:23 +00:00
Bruce Momjian 590510136e Addendum: psql sequence value display patch was originally written by
Euler Taveira de Oliveira.
2008-07-15 16:06:06 +00:00
Bruce Momjian 8516ce0914 Have psql \d show the value of sequence columns.
Dickson S. Guedes
2008-07-15 03:16:03 +00:00
Bruce Momjian bf523f97ca Add comment about literal strings in our syntax not being translated in
psql.
2008-07-14 23:13:04 +00:00
Bruce Momjian 71e0296dbc Add column storage type to psql \d+ display.
Gregory Stark
2008-07-14 22:51:48 +00:00
Bruce Momjian c9b2591efc In psql, rename trans_* variables to translate_*, for clarity. 2008-07-14 22:00:04 +00:00
Peter Eisentraut 96193aa803 More replacements of binary compatible to binary coercible. 2008-07-12 10:44:56 +00:00
Peter Eisentraut b11c1876ed Don't print the name of the database in psql \z. 2008-07-03 15:59:55 +00:00
Tom Lane 0a8f6b797a Fix psql's \d and allied commands to work with all server versions back to 7.4.
Guillaume Lelarge, with some additional fixes by me.
2008-07-03 03:37:17 +00:00
Heikki Linnakangas 65919ec949 Move volatility, language, etc. modifiers before function body in the pg_dump
output for CREATE FUNCTION. This makes it easier to read especially if the
function body is long.

Original idea and patch by Greg Sabino Mullane, though this is a stripped
down version of that.
2008-07-01 11:46:48 +00:00
Bruce Momjian 92d1cc8973 Issue psql connection warnings on connection start and via \c, per
observation by David Fetter.
2008-07-01 00:08:18 +00:00
Bruce Momjian 4688e6d9cb Fix pg_ctl bug where detection of binary location from postmaster.opts
wasn't working.
2008-06-26 18:25:24 +00:00
Bruce Momjian 7cc1fb4768 Simplify 'pg_ctl restart' detection of first argument in
postmaster.opts.
2008-06-26 03:51:56 +00:00
Bruce Momjian 067f1e5fa8 Fix 'pg_ctl restart' to preserve command-line arguments. 2008-06-26 02:47:19 +00:00
Bruce Momjian a1183238be Use SYSTEMQUOTE as concatentation to strings, rather than %s printf
patterns, for clarity.
2008-06-26 01:35:45 +00:00
Bruce Momjian 124c22d5fd Remove use of postmaster.opts.default by pg_ctl. 2008-06-26 01:12:20 +00:00
Heikki Linnakangas 15dc3f59c7 Update "help" output to reflect that \timing now takes an optional on/off
argument.
2008-06-11 10:55:43 +00:00
Heikki Linnakangas 8b64a2642a Add optional on/off argument to \timing.
David Fetter.
2008-06-11 10:48:17 +00:00
Neil Conway 109940c635 Editorialization for the text emitted by the "help" psql command.
Basically just reuse the same text that psql emitted as part of
its startup banner in prior versions, and make some whitespace
more consistent with the conventions in other psql command output.
2008-06-10 20:58:19 +00:00
Tom Lane eaa70a3891 Fix initdb to reject a relative path for -X (--xlogdir) argument. This
doesn't work, and the real reason why not is it's unclear where the path
is relative to (initdb's CWD, or the data directory?).  We could make an
arbitrary decision, but it seems best to make the user be unambiguous.
Per gripe from Devrim.
2008-06-02 03:48:00 +00:00
Magnus Hagander 06e6573d57 Fix function headers not matching prototype in header file, per
compiler warnings on msvc.
2008-05-21 16:00:10 +00:00
Andrew Dunstan 07d08a8828 Remove old kluge put in to allow Windows regression tests to succeed, and now
found to have been made necessary by our skipping tty detection on Windows. Now
that we are doing tty detection on Windows the kluge is unnecessary and wrong.
2008-05-18 06:50:08 +00:00
Bruce Momjian 265f19d78b Use isatty() test for pager on Win32; not sure why it was disabled for
that platform.
2008-05-17 23:34:44 +00:00
Bruce Momjian e2cd62c3e1 In psql, test for output to stdout when forcing pager for wide output. 2008-05-17 21:40:44 +00:00