Commit Graph

26497 Commits

Author SHA1 Message Date
Peter Eisentraut 02504dfd0a Write the objfiles.txt rules in a way that is compatible with GNU make 3.78,
and simpler, too.
2008-02-29 10:34:51 +00:00
Neil Conway ff428cdeda Fix several memory leaks when rescanning SRFs. Arrange for an SRF's
"multi_call_ctx" to be a distinct sub-context of the EState's per-query
context, and delete the multi_call_ctx as soon as the SRF finishes
execution. This avoids leaking SRF memory until the end of the current
query, which is particularly egregious when the SRF is scanned
multiple times. This change also fixes a leak of the fields of the
AttInMetadata struct in shutdown_MultiFuncCall().

Also fix a leak of the SRF result TupleDesc when rescanning a
FunctionScan node. The TupleDesc is allocated in the per-query context
for every call to ExecMakeTableFunctionResult(), so we should free it
after calling that function. Since the SRF might choose to return
a non-expendable TupleDesc, we only free the TupleDesc if it is
not being reference-counted.

Backpatch to 8.3 and 8.2 stable branches.
2008-02-29 02:49:39 +00:00
Magnus Hagander b13635ce59 Support for building contrib/uuid-ossp with MSVC.
Original patch from Hiroshi Saito, modified by me.
2008-02-28 12:17:59 +00:00
Peter Eisentraut b8eef28353 Change expand_subsys function so that it preserves the relative order of
the files passed as argument.  This is desirable so that the dtrace rule
in src/backend/Makefile works.
2008-02-27 20:31:01 +00:00
Tom Lane 1743778d04 If RelationBuildDesc() fails to open a critical system index, PANIC with
a relevant error message instead of just dumping core.  Odd that nobody
reported this before Darren Reed.
2008-02-27 17:44:19 +00:00
Peter Eisentraut 00941eea77 Add more clarification about SSH tunnels from Faheem Mitha. 2008-02-26 18:01:26 +00:00
Peter Eisentraut f49beb3f50 In the SSH setup instructions, change
ssh -L 3333:foo.com:5432 joe@foo.com

I think this should be changed to

ssh -L 3333:localhost:5432 joe@foo.com

The reason is that this assumes the postgres server on foo.com allows
connections from foo.com, which is not allowed by the default
listen_addresses setting.  Add more detail explaining this.

pointed out by Faheem Mitha

Also change the example port number 3333 to 63333 so no one can complain
that we are stealing a reserved port number.
2008-02-26 16:07:16 +00:00
Peter Eisentraut f26203ef32 Add information about format modifiers that apply to numeric formats.
These were previously only documented in the context of date/time formats.
2008-02-26 15:32:30 +00:00
Peter Eisentraut bd929b4909 Fixed dtrace build
found by Magne Mæhre
2008-02-26 14:42:27 +00:00
Peter Eisentraut 9623b727da Don't build the win32 support files in the all target, only in distprep and
when they are actually needed as prerequisites.
2008-02-26 14:26:16 +00:00
Peter Eisentraut f6f8d61a47 Fix uninstall target. 2008-02-26 13:48:57 +00:00
Peter Eisentraut 0e04ee41d0 Create two separate libpq.rc's: One that is built at build time, and one
that is shipped in the distribution, named libpq-dist.rc.  This way the
build system doesn't get upset when a distributed file is forcibly
overwritten by during a normal build.
2008-02-26 13:31:40 +00:00
Peter Eisentraut bdaf90b70f Reorganize some of the exports list generation code. It seems that this
has been reinvented about four different times throughout history (aix,
cygwin, win32, darwin/linux) and a lot of the concepts are actually shared,
which the code now shows better.
2008-02-26 10:45:24 +00:00
Peter Eisentraut 734a56ca2e Escape # character in variable assignment 2008-02-26 10:30:06 +00:00
Peter Eisentraut d391bdac50 Need more dependencies to get the build order right when objfiles.txt
doesn't exist yet.
2008-02-26 08:23:31 +00:00
Peter Eisentraut 3690019da8 We don't need to rebuild objfiles.txt every time an object file changes.
So only rebuild when a makefile changes (which presumably defines the
file list somewhere), and only touch the file if an object changed. The
touch is necessary so the parent make knows something changed and
ultimately rebuilds postgres.
2008-02-26 07:20:38 +00:00
Peter Eisentraut a1d5d85747 Refactor the code that creates the shared library export files to appear
only once in Makefile.shlib and not in four copies.
2008-02-26 06:41:24 +00:00
Tom Lane fd15dba543 Fix encode(...bytea..., 'escape') so that it converts all high-bit-set byte
values into \nnn octal escape sequences.  When the database encoding is
multibyte this is *necessary* to avoid generating invalidly encoded text.
Even in a single-byte encoding, the old behavior seems very hazardous ---
consider for example what happens if the text is transferred to another
database with a different encoding.  Decoding would then yield some other
bytea value than what was encoded, which is surely undesirable.  Per gripe
from Hernan Gonzalez.

Backpatch to 8.3, but not further.  This is a bit of a judgment call, but I
make it on these grounds: pre-8.3 we don't really have much encoding safety
anyway because of the convert() function family, and we would also have much
higher risk of breaking existing apps that may not be expecting this behavior.
8.3 is still new enough that we can probably get away with making this change
in the function's behavior.
2008-02-26 02:54:08 +00:00
Tom Lane bc93919be7 Reject year zero during datetime input, except when it's a 2-digit year
(then it means 2000 AD).  Formerly we silently interpreted this as 1 BC,
which at best is unwarranted familiarity with the implementation.
It's barely possible that some app somewhere expects the old behavior,
though, so we won't back-patch this into existing release branches.
2008-02-25 23:36:28 +00:00
Tom Lane 05506fc4af Fix datetime input to behave correctly for Feb 29 in years BC.
Formerly, DecodeDate attempted to verify the day-of-the-month exactly, but
it was under the misapprehension that it would know whether we were looking
at a BC year or not.  In reality this check can't be made until the calling
function (eg DecodeDateTime) has processed all the fields.  So, split the
BC adjustment and validity checks out into a new function ValidateDate that
is called only after processing all the fields.  In passing, this patch
makes DecodeTimeOnly work for BC inputs, which it never did before.

(The historical veracity of all this is nonexistent, of course, but if
we're going to say we support proleptic Gregorian calendar then we should
do it correctly.  In any case the unpatched code is broken because it could
emit dates that it would then reject on re-inputting.)

Per report from Bernd Helmle.  Back-patch as far as 8.0; in 7.x we were
not using our own calendar support and so this seems a bit too risky
to put into 7.4.
2008-02-25 23:21:01 +00:00
Peter Eisentraut 9956ddc191 Link postgres from all object files at once, to avoid the error-prone
SUBSYS.o step and allow for better optimization by the linker.

Instead of partial linking into SUBSYS.o, the list of object files is
assembled in objfiles.txt files that are expanded when the final
linking is done.

Because we are not yet sure how long command lines different platforms
can handle, the old way of linking is still available, by defining the
make variable PARTIAL_LINKING (e.g., make all PARTIAL_LINKING=1).  If
we determine that this is necessary for some platforms, then we will
document this in a more prominent place.
2008-02-25 17:55:42 +00:00
Tom Lane ad20c990f7 Use our own getopt() and getopt_long() on Solaris, because that platform's
versions don't handle long options the way we want.  Per Zdenek Kotala.
2008-02-24 05:21:54 +00:00
Tom Lane 2e0e563124 Avoid trying to print a NULL char pointer in --describe-config. On some
platforms this works, but on some it crashes.  Zdenek Kotala
2008-02-23 19:23:33 +00:00
Tom Lane 9713c06319 Change the declaration of struct varlena so that the length word is
represented as "char ...[4]" not "int32".  Since the length word is never
supposed to be accessed via this struct member anyway, this won't break
any existing code that is following the rules.  The advantage is that C
compilers will no longer assume that a pointer to struct varlena is
word-aligned, which prevents incorrect optimizations in TOAST-pointer
access and perhaps other places.  gcc doesn't seem to do this (at least
not at -O2), but the problem is demonstrable on some other compilers.

I changed struct inet as well, but didn't bother to touch a lot of other
struct definitions in which it wouldn't make any difference because there
were other fields forcing int alignment anyway.  Hopefully none of those
struct definitions are used for accessing unaligned Datums.
2008-02-23 19:11:45 +00:00
Tom Lane 870993e871 Rename miscadmin.h's PG_VERSIONSTR macro to PG_BACKEND_VERSIONSTR to
make it a bit clearer what it is, and get rid of duplicate definitions
in initdb and pg_ctl.
2008-02-20 22:46:24 +00:00
Tom Lane 8dd6c4b4be Make pg_regress -V consistent with the corresponding code in other
programs: use puts with a compile-time-constant string.
2008-02-20 22:44:16 +00:00
Tom Lane 7454515e12 Fix mistakes in pg_ctl's code for "start -w" that tries to cope with
non-default settings for the postmaster's port number.  The code to parse
command line options and postgresql.conf entries wasn't quite right about
whitespace or quotes, and it was coded in a not-very-readable way too.
Per bug #3969 from Itagaki Takahiro, though this is more extensive than his
proposed patch (which fixed only the whitespace problem).
This code has been broken since it was put in in 8.0, so patch all the way
back.
2008-02-20 22:18:15 +00:00
Tom Lane 5ce6829b73 Put a CHECK_FOR_INTERRUPTS call into the loops that try to find a unique new
OID or new relfilenode.  If the existing OIDs are sufficiently densely
populated, this could take a long time (perhaps even be an infinite loop),
so it seems wise to allow the system to respond to a cancel interrupt here.
Per a gripe from Jacky Leng.

Backpatch as far as 8.1.  Older versions just fail on OID collision,
instead of looping.
2008-02-20 17:44:09 +00:00
Alvaro Herrera f78611bba4 Improve error messages emitted when VACUUM and ANALYZE skip a table.
Per gripe from Clodoaldo Pinto Neto on
Message-ID: <a595de7a0801060326qbfc790ax2a60573043c2e2be@mail.gmail.com>
2008-02-20 14:31:35 +00:00
Alvaro Herrera bccc8e3608 Change error message to be able to differentiate the two cases. Per suggestion
from Jaime Casanova.
2008-02-20 14:01:45 +00:00
Peter Eisentraut 95ea526e21 Backport fixed AC_FUNC_FSEEKO 2008-02-19 18:02:30 +00:00
Magnus Hagander 66c80bfd98 Un-break msvc port yet again (it started pulling in the Darwin
port files, which obviously didn't compile)
2008-02-19 16:15:14 +00:00
Peter Eisentraut c7054a6c14 More refactoring, so that the SUBSYS.o rules are now all in one place. 2008-02-19 15:29:58 +00:00
Peter Eisentraut e2f16cd0ef This subdirectory has been unused, dead, and broken for 10 years. 2008-02-19 13:08:56 +00:00
Magnus Hagander 592487823d Fix function prototype to silence compiler warnings. 2008-02-19 12:06:35 +00:00
Magnus Hagander fae032c9fc Unbreak MSVC build after recent addition of HTMLDIR. 2008-02-19 12:00:03 +00:00
Peter Eisentraut 1f4a587fc3 Remove another target I forgot during the refactoring 2008-02-19 11:49:12 +00:00
Peter Eisentraut 0474dcb608 Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
Bruce Momjian a74e0414a2 Put back code modularization of fseeko() configure checks. 2008-02-19 01:05:28 +00:00
Bruce Momjian 7f9693b4fd Put fseeko check back in old location, in hopes of silencing build warnings. 2008-02-19 00:46:43 +00:00
Tom Lane cf59277ac9 Remove unnecessary opening of other relation in RI_FKey_keyequal_upd_pk
and RI_FKey_keyequal_upd_fk, as well as no-longer-needed calls of
ri_BuildQueryKeyFull.  Aside from saving a few cycles, this avoids needless
deadlock risks when an update is not changing the columns that participate
in an RI constraint.  Per a gripe from Alexey Nalbat.

Back-patch to 8.3.  Earlier releases did have a need to open the other
relation due to the way in which they retrieved information about the RI
constraint, so this problem unfortunately can't easily be improved pre-8.3.

Tom Lane and Stephan Szabo
2008-02-18 23:00:32 +00:00
Bruce Momjian fc54be81d1 autoconf 2.61's AC_FUNC_FSEEKO reports success/failure differently, so
reorganize code for NetBSD/BSDi port/fseeko.c usage, and make code more
modular.
2008-02-18 21:46:22 +00:00
Peter Eisentraut a345dcd2f7 Observe errors in makefile 2008-02-18 16:04:32 +00:00
Peter Eisentraut 84ce707ba8 Added --htmldir option to pg_config, equivalent to the new configure option. 2008-02-18 14:51:48 +00:00
Michael Meskes a9bc069c0b - Removed duplicate include of ecpgtype.h which meant I had to adapt all expected results.
- Changed INFORMIX mode symbol definition yet again because the old way didn't work on NetBSD. Hopefully this one does.
2008-02-17 18:14:29 +00:00
Peter Eisentraut b120382353 Upgrade to Autoconf 2.61:
- Change configure.in to use Autoconf 2.61 and update generated files.
- Update build system and documentation to support now directory variables
  offered by Autoconf 2.61.
- Replace usages of PGAC_CHECK_ALIGNOF by AC_CHECK_ALIGNOF, now available
  in Autoconf 2.61.
- Drop our patched version of AC_C_INLINE, as Autoconf now has the change.
2008-02-17 16:36:43 +00:00
Tom Lane 8b63aa1ffc Add back #include <time.h> in a couple of files that seem to need it
on Linux.
2008-02-17 04:21:05 +00:00
Tom Lane cd00406774 Replace time_t with pg_time_t (same values, but always int64) in on-disk
data structures and backend internal APIs.  This solves problems we've seen
recently with inconsistent layout of pg_control between machines that have
32-bit time_t and those that have already migrated to 64-bit time_t.  Also,
we can get out from under the problem that Windows' Unix-API emulation is not
consistent about the width of time_t.

There are a few remaining places where local time_t variables are used to hold
the current or recent result of time(NULL).  I didn't bother changing these
since they do not affect any cross-module APIs and surely all platforms will
have 64-bit time_t before overflow becomes an actual risk.  time_t should
be avoided for anything visible to extension modules, however.
2008-02-17 02:09:32 +00:00
Bruce Momjian ee7a6770f6 Move item as done:
<
> * -Allow AS in "SELECT col AS label" to be optional in certain cases
>
< * Allow AS in "SELECT col AS label" to be optional (not wanted)
2008-02-16 23:27:34 +00:00
Tom Lane 2874d38d7f Update docs to reflect the fact that we can now deal with DST rules
outside the 32-bit-time_t range.  Also, refer to Olson's tz database
as the 'zoneinfo' database, a name that upstream sometimes uses, not
'zic database' which they never use.
2008-02-16 21:51:04 +00:00