Commit Graph

269 Commits

Author SHA1 Message Date
Peter Eisentraut 5266f221a2 Merge postmaster and postgres command into just postgres. postmaster
symlink is kept for now for compatibility.  To call single-user mode, use
postgres --single.
2006-06-18 15:38:37 +00:00
Bruce Momjian 399a36a75d Prepare code to be built by MSVC:
o  remove many WIN32_CLIENT_ONLY defines
	o  add WIN32_ONLY_COMPILER define
	o  add 3rd argument to open() for portability
	o  add include/port/win32_msvc directory for
	   system includes

Magnus Hagander
2006-06-07 22:24:46 +00:00
Bruce Momjian f2f5b05655 Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
Tom Lane a25cd81007 Enable pg_ctl to give up admin privileges when starting the server under
Windows (if newer than NT4, else works same as before).

Magnus
2006-02-10 22:00:59 +00:00
Peter Eisentraut 4d464076ff Make --version option print fixed program name. 2006-02-07 11:36:36 +00:00
Peter Eisentraut 7930e627d8 Fix pg_ctl crash on "unregister" when a data directory is not specified.
by Magnus Hagander
2006-01-14 15:41:28 +00:00
Bruce Momjian 44f9021223 Remove BEOS port. 2006-01-05 03:01:38 +00:00
Bruce Momjian 436a2956d8 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:17:34 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Tom Lane 4a2972d691 Awhile back we replaced all uses of strcasecmp and strncasecmp with
pg_strcasecmp and pg_strncasecmp ... but I see some of the former have
crept back in.
Eternal vigilance is the price of locale independence, apparently.
2005-07-25 04:52:32 +00:00
Bruce Momjian e8a3e6b8a0 Rename xmalloc to pg_malloc for consistency with psql usage.
Add missing plperl include.
2005-07-10 16:13:13 +00:00
Tom Lane 6f7fc0bade Cause initdb to create a third standard database "postgres", which
unlike template0 and template1 does not have any special status in
terms of backend functionality.  However, all external utilities such
as createuser and createdb now connect to "postgres" instead of
template1, and the documentation is changed to encourage people to use
"postgres" instead of template1 as a play area.  This should fix some
longstanding gotchas involving unexpected propagation of database
objects by createdb (when you used template1 without understanding
the implications), as well as ameliorating the problem that CREATE
DATABASE is unhappy if anyone else is connected to template1.
Patch by Dave Page, minor editing by Tom Lane.  All per recent
pghackers discussions.
2005-06-21 04:02:34 +00:00
Tom Lane 13f75e378e Use postmaster_is_alive() check in pg_ctl restart as well as pg_ctl status,
so that restart doesn't fail when old postmaster died unbetimes.
2005-05-04 22:35:15 +00:00
Tom Lane 2f8c7c866c Make pg_ctl status do a kill() test to verify that the PID found in
postmaster.pid still represents a live postmaster.
2005-04-20 23:10:16 +00:00
Bruce Momjian 3bc6bdf322 Define snprintf() to call pg_snprintf() so our own snprintf-like
implementation doesn't export out via libpq and get used by a user
application.
2005-03-11 17:20:35 +00:00
Bruce Momjian 0542b1e2fe Use _() macro consistently rather than gettext(). Add translation
macros around strings that were missing them.
2005-02-22 04:43:23 +00:00
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00
Tom Lane 63a90720b4 Remove extra parenthesis. 2004-12-23 00:03:24 +00:00
Bruce Momjian c21c658b36 Add error checking for starting a win32 service using pg_ctl. 2004-12-21 17:58:30 +00:00
Bruce Momjian 556e72124c Return proper error exit code on pg_ctl -w start failure. 2004-12-21 17:38:01 +00:00
Neil Conway b3f3092cad Fix off-by-1 bug in pg_ctl in -D handling, per report from pjmodos@parba.cz 2004-12-06 01:09:20 +00:00
Tom Lane 90c3ebe4d7 Fix HAVE_OPTRESET to be HAVE_INT_OPTRESET. Typos spotted by Lorne Sunley. 2004-11-27 18:51:08 +00:00
Tom Lane 5d72ef83fd Miscellaneous Cygwin build fixes from Reini Urban. 2004-11-17 17:46:24 +00:00
Tom Lane 18b58350db Be sure length limit passed to snprintf matches what malloc was given.
Just paranoia ...
2004-11-17 16:34:42 +00:00
Bruce Momjian 54691d414d Fix psql \e and \! for Win32. 2004-11-04 22:25:14 +00:00
Bruce Momjian a7049b52e3 Have pg_ctl status always output to stdout, even stopped status, not stderr. 2004-10-27 19:44:14 +00:00
Bruce Momjian 3fe704209a Canonicalize Win32 path coming in from pg_ctl -D, idea from Magnus. 2004-10-27 17:17:09 +00:00
Tom Lane c58675b428 Prevent pg_ctl from being run as root. Since it uses configuration files
owned by postgres, doing "pg_ctl start" as root could allow a privilege
escalation attack, as pointed out by iDEFENSE.  Of course the postmaster would
fail, but we ought to fail a little sooner to protect sysadmins unfamiliar
with Postgres.  The chosen fix is to disable root use of pg_ctl in all cases,
just to be confident there are no other holes.
2004-10-22 00:24:18 +00:00
Peter Eisentraut 9f2d5df3b9 Organize the help output a little better. Improve clarity of some messages. 2004-10-19 13:38:53 +00:00
Bruce Momjian 72f9013741 Fix Cygwin using of pg_ctl by not usig START.
Reini Urban
2004-10-16 03:32:08 +00:00
Bruce Momjian 88fd162ef6 Allow pg_ctl to determine the server is up when getting a request for a
password.

Make password error message a #define and use it consistently.

Sean Chittenden
2004-10-16 03:10:17 +00:00
Bruce Momjian 8613eac6c4 Fix pg_ctl -D handling for Win32:
C:\msys\1.0\home\y-asaba>pg_ctl -D data restart
	waiting for postmaster to shut down...LOG:  received smart shutdown
	request.
	LOG:  shutting down
	LOG:  database system is shut down
	done
	postmaster stopped

	postmaster starting

	C:\msys\1.0\home\y-asaba>postmaster.exe: invalid argument: "'-D'"
	Try "postmaster.exe --help" for more information.

Yoshiyuki Asaba
2004-10-15 04:54:33 +00:00
Bruce Momjian a49f6ad014 Add full path in error report for version mismatch of binaries. 2004-10-15 04:32:28 +00:00
Neil Conway 8ff374ce91 psql code cleanup:
- refactor a bunch of code to call a separate function print_msg() which
checks whether "silent mode" is enabled before printing an error
message.

- rename "silence_mode" to "silent_mode", which IMHO makes more sense

- make the error messages we emit in "waiting" mode more consistent; I
believe this fixes a recent error message regression
2004-10-15 01:36:12 +00:00
Bruce Momjian c55de22d94 Enable service use by Cygwin of pg_ctl. 2004-10-13 10:35:05 +00:00
Peter Eisentraut 0fd37839d9 Message style revisions 2004-10-12 21:54:45 +00:00
Neil Conway 0e72b9d440 Cosmetic improvements/code cleanup:
- replace some function signatures of the form "some_type foo()" with
"some_type foo(void)"
- replace a few instances of a literal 0 being used as a NULL pointer;
there are more instances of this in the code, but I just fixed a few
- in src/backend/utils/mb/wstrncmp.c, replace K&R style function
declarations with ANSI style, remove use of 'register' keyword
- remove an "extern" modifier that was applied to a function definition
(rather than a declaration)
2004-10-10 23:37:45 +00:00
Bruce Momjian a5d7ba773d Adjust comments previously moved to column 1 by pgident. 2004-10-07 15:21:58 +00:00
Tom Lane 6ad853b975 Yet another place where someone was being careless about the arguments
of <ctype.h> macros.
2004-09-02 20:07:50 +00:00
Bruce Momjian b6b71b85bc Pgindent run for 8.0. 2004-08-29 05:07:03 +00:00
Bruce Momjian da9a8649d8 Update copyright to 2004. 2004-08-29 04:13:13 +00:00
Bruce Momjian fe90fb4d37 The attached patch improves pg_ctl's win32 service code to eliminate
some possible causes of the stale postmaster.pid problem that some users
have reported.

- The service did not properly report that it accepts
SERVICE_CONTROL_SHUTDOWN events, thus it's possible the SCM simply
killed the postmaster on shutdown.

- 'WaitHints' are now given to the SCM to prevent it timing out if
pg_ctl doesn't respond to a control event quickly enough.

- During shutdown, the service checkpoint counter is incremented every
five seconds for up to a minute to prevent the SCM timing out and
assuming the service is not responding.

Dave Page
2004-08-28 23:26:37 +00:00
Bruce Momjian c8702dcb8e Propogate pg_ctl -D to the postmaster for command-line identification. 2004-08-28 22:04:01 +00:00
Bruce Momjian a0a61f494d > > Another issue is that when installing the Postgres service with
> > "pg_ctl register -w ...." the "-w" parameter was not put in
> the registry "ImagePath"
> > value for the Postgres service. (I added it manually to test.) So I
> > suspect that "pg_ctl register" will need to be enhanced to add the
> > "-w" parameter to the registry settings.

Dave Page
2004-08-28 21:01:38 +00:00
Bruce Momjian 34f34a041c Fix pg_ctl -w to properly wait on server startup. 2004-08-21 03:12:55 +00:00
Bruce Momjian 7f42dabca8 Fix for pg_ctl -o processing. Report from Sean Chittenden. 2004-07-29 16:11:11 +00:00
Tom Lane 664291107e Avoid default: followed by no statement, per Dann Corbit. 2004-07-22 01:44:36 +00:00
Bruce Momjian 036ecf7afb > pg_ctl --help
>  ---skiped---
>   -P       user name of account to register PostgreSQL server
>   -U       password  of account to register PostgreSQL server
> ---skiped---
>
> I think that isn't right ;)

Claudio Natoli
2004-07-15 15:23:32 +00:00
Bruce Momjian 5ee0a8dcb6 canonicalization adjustments. 2004-07-12 19:18:18 +00:00
Bruce Momjian a4c71af2c0 Put back canonicalization of PGDATA environment variable. 2004-07-12 19:15:14 +00:00
Bruce Momjian 76e7e2e776 Use strdup in pg_ctl for canonicalize_path on environment variable.
Simplify postmaster call too.
2004-07-12 18:17:13 +00:00
Dennis Bjorklund fbe4b75515 Make pg_ctl possible to translate. Strings marked for
translation has to be complete sentences.
2004-06-25 08:49:28 +00:00
Tom Lane f8dd00c3ef Extend pg_ctl to handle service management under WIN32. Lacks docs.
Claudio Natoli and Magnus Hagander
2004-06-24 18:23:26 +00:00
Bruce Momjian 8d64b56206 Cleanup use of Win32 START by using "" for title. No need for temp
batch files anymore.
2004-06-11 16:36:31 +00:00
Bruce Momjian eae2a7204f Another fix for Win32 START. 2004-06-11 04:17:21 +00:00
Bruce Momjian 5fe8c7d6e5 More restructuring to use Win32 START with paths needing quotes. 2004-06-11 00:57:25 +00:00
Bruce Momjian d4117de50a More quoting cleanups for Win32's pg_ctl. 2004-06-10 22:20:53 +00:00
Bruce Momjian c9d327b866 Use /B to start so a new window isn't created, per Andrew Dunstan. 2004-06-10 18:02:36 +00:00
Bruce Momjian 75db5a665f Add START background code for another code path, per Andrew Dunstan. 2004-06-10 17:45:09 +00:00
Bruce Momjian 3a854af433 Use START for pg_ctl background runs on Win32, from Magnus. 2004-06-10 17:26:14 +00:00
Bruce Momjian 10a3d19ad4 Handle multiple double-quoted strings using Win32's system() call.
Document limitations.
2004-06-10 16:35:18 +00:00
Bruce Momjian dc6c8c2d06 Use single quotes for pg_ctl system call. 2004-06-09 17:36:07 +00:00
Bruce Momjian bf2a115f2f Remove dash in pg_ctl signal name. It broke with getopt_long dash
reorganization processing, and it is clearer without the dash anyway.
2004-06-04 04:05:36 +00:00
Bruce Momjian 6870843339 Add PGETC (for pg_service.conf) and PGLOCALE (for locale dir)
environment variable processing to libpq.

The patch also adds code to our client apps so we set the environment
variable directly based on our binary location, unless it is already
set. This will allow our applications to emit proper locale messages
that are generated in libpq.
2004-06-03 00:07:38 +00:00
Bruce Momjian 4d0e47d5a9 Add locale setting for pg_ctl. 2004-06-01 22:03:18 +00:00
Bruce Momjian 962a94bb5a More locale fixes for pg_ctl. 2004-06-01 03:32:42 +00:00
Bruce Momjian 66fa6eba5a Add pgpid_t for use with pids. 2004-06-01 01:28:03 +00:00
Bruce Momjian d534b9ee9e Have pg_ctl print pid and error on signal failure, per suggestion from Tom. 2004-05-31 17:57:31 +00:00
Bruce Momjian f3d6d948c7 Change pg_ctl to be in C. This was the final shell script and is
helpful for the Win32 port.

Andrew Dunstan, with additions by Bruce.
2004-05-27 03:37:55 +00:00