Tom Lane [Wed, 31 May 2000 15:38:53 +0000 (15:38 +0000)]
Tweak recognition of range-clause pairs so that 'var > $1 AND var < $2'
(ie, parameters instead of consts) will be treated as a range query.
We do not know the actual selectivities involved, but it seems like
a good idea to use a smaller estimate than we would use for two unrelated
inequalities.
Peter Eisentraut [Wed, 31 May 2000 00:28:42 +0000 (00:28 +0000)]
The heralded `Grand Unified Configuration scheme' (GUC)
That means you can now set your options in either or all of $PGDATA/configuration,
some postmaster option (--enable-fsync=off), or set a SET command. The list of
options is in backend/utils/misc/guc.c, documentation will be written post haste.
pg_options is gone, so is that pq_geqo config file. Also removed were backend -K,
-Q, and -T options (no longer applicable, although -d0 does the same as -Q).
Tom Lane [Tue, 30 May 2000 04:25:00 +0000 (04:25 +0000)]
Third round of fmgr updates: eliminate calls using fmgr() and
fmgr_faddr() in favor of new-style calls. Lots of cleanup of
sloppy casts to use XXXGetDatum and DatumGetXXX ...
Tom Lane [Mon, 29 May 2000 20:18:30 +0000 (20:18 +0000)]
Tweak fmgrtab generation so that the F_XXX macros that give OIDs for
built-in procedures are named after the prosrc field of pg_proc (ie,
the actual C function name), not the proname field. This did not use
to make a difference back when the two were always the same, but in the
presence of overloaded proname values we'd best try to use the C name
instead. AFAICT this change affects no existing code, but it is
necessary to be able to get at some built-in functions that no macro
was being generated for before.
Tom Lane [Mon, 29 May 2000 19:16:57 +0000 (19:16 +0000)]
Repair problems with overrun of timezone name length. Increase MAXTZLEN
to 10, and be consistent about whether it counts the trailing null (it
does not). Also increase MAXDATELEN to be sure no buffer overflows are
caused by the longer MAXTZLEN.
Tom Lane [Mon, 29 May 2000 05:45:56 +0000 (05:45 +0000)]
Generated header files parse.h and fmgroids.h are now copied into
the src/include tree, so that -I backend is no longer necessary anywhere.
Also, clean up some bit rot in contrib tree.
Tom Lane [Sun, 28 May 2000 20:33:28 +0000 (20:33 +0000)]
Constant-expression simplifier now knows how to simplify strict functions
that have at least one constant-NULL input, even if other inputs are
not constants.
Tom Lane [Sun, 28 May 2000 17:56:29 +0000 (17:56 +0000)]
First round of changes for new fmgr interface. fmgr itself and the
key call sites are changed, but most called functions are still oldstyle.
An exception is that the PL managers are updated (so, for example, NULL
handling now behaves as expected in plperl and plpgsql functions).
NOTE initdb is forced due to added column in pg_proc.
Tom Lane [Sat, 27 May 2000 05:13:38 +0000 (05:13 +0000)]
define YY_NEVER_INTERACTIVE for flex, to persuade flex that it's not
necessary to call isatty() for each and every received query. That's
one less kernel call per query cycle ...
Tom Lane [Fri, 26 May 2000 17:19:15 +0000 (17:19 +0000)]
Reduce eqsel()'s fudge-factor for estimating the frequency of values
other than the most common value in a column. We had had 0.5, make it
0.1 to make it more likely that an indexscan will be chosen. Really
need better statistics instead, but this should stem the bleeding
meanwhile ...
Tom Lane [Fri, 26 May 2000 01:26:19 +0000 (01:26 +0000)]
After closing frontend socket, set MyProcPort->sock = -1 to ensure that
subsequent I/O attempts fail cleanly. I'm speculating about failure
scenarios in which we do pq_close, then something in a proc_exit routine
opens a file (re-using that kernel FD number), then something else
fails and tries to write an elog message to the frontend ... message
ends up in opened file, oops. No known examples of this but it seems
like a potential hole.
Tom Lane [Thu, 25 May 2000 22:42:19 +0000 (22:42 +0000)]
Modify raw parsetree representation returned by gram.y for SubLinks:
the oper field should be a valid Node structure so it can be dumped by
outfuncs.c without risk of coredump. (We had been using a raw pointer
to character string, which surely is NOT a valid Node.) This doesn't
cause any backwards compatibility problems for stored rules, since
raw unanalyzed parsetrees are never stored.
Tom Lane [Thu, 25 May 2000 21:30:20 +0000 (21:30 +0000)]
Do table renaming in a sane order: physical file rename must happen
*last*, after all updating of system catalogs. In old code, an error
detected during TypeRename left the relation hosed. Also, add a call
to flush the relation's relcache entry, rather than trusting to shared
cache invalidation to flush it for us.
Bruce Momjian [Thu, 25 May 2000 19:09:55 +0000 (19:09 +0000)]
! * Users doing non-blocking connections need to handle the reset
! * themselves, they'll need to check the connection status if we
! * return an error.
Tatsuo Ishii [Thu, 25 May 2000 06:53:43 +0000 (06:53 +0000)]
On solaris, createdb/dropdb fails because of strange behavior of system().
(it returns error with errno ECHILD upon successful completion of commands).
This fix ignores an error from system() if errno == ECHILD.
Tom Lane [Tue, 23 May 2000 16:56:37 +0000 (16:56 +0000)]
Fix problem in which sloppily-coded test in ExecInitIndexScan would
think that both sides of indexqual look like index keys. An example is
create table inside (f1 float8 primary key);
create table outside (g1 float8, g2 float8);
select * from inside,outside where f1 = atan2(g1+1, g2);
ERROR: ExecInitIndexScan: both left and right ops are rel-vars
(note that failure is potentially platform-dependent). Solution is a
cleanup I had had in mind to make anyway: functional index keys should
be represented as Var nodes in the fixed indexqual, just like regular
index keys.
Tom Lane [Tue, 23 May 2000 04:55:44 +0000 (04:55 +0000)]
Twiddle C++ configuration checks so that we #include <string> (if
it exists) before testing 'using namespace std'. This is necessary
on some C++ setups where the compiler won't take a 'using' until
you've included a header that mentions namespace std. (Pretty braindead
if you ask me, but...)
Tom Lane [Tue, 23 May 2000 02:12:46 +0000 (02:12 +0000)]
Transmit -I switches selected by configure (particularly those from
--with-includes) to makefiles for pltcl and plperl, so that these
switches will be used even though we do not want other top-level
CFLAGS. Ain't it fun trying to support multiple-compiler platforms?
Bruce Momjian [Mon, 22 May 2000 02:34:23 +0000 (02:34 +0000)]
I am attempting to integrate postgres (v 7.0) with an open source
project I am working on (Recall - a distributed, fault-tolerant,
replicated, storage framework @ http://www.fault-tolerant.org).
Recall is written in C++. I need to include the postgres headers and
there are some problems when including the headers w/C++.
Attached is a patch generated from postgres/src that fixes my problems.
I was hoping to get this into the main source. It's very small (2k) and
3 files are changed: backend/utils/fmgr/fmgr.c,
backend/utils/Gen_fmgrtab.sh.in, and include/access/tupdesc.h.
In C++, you get a multiply defined symbol because the variable
(FmgrInfo *fmgr_pl_finfo) is defined in the header (the patch moves it
to the .c file). The other problem in tupdesc.h is the use of typeid
is a problem in c++ (I renamed it to oidtypeid).
Tom Lane [Sun, 21 May 2000 21:19:53 +0000 (21:19 +0000)]
Remove calls to getprotobyname(), which we now know leaks memory on
some platforms --- and I also see that it is documented as not thread-
safe on HPUX and possibly other platforms. No good reason not to just
use IPPROTO_TCP constant from <netinet/in.h> instead.
Tom Lane [Sun, 21 May 2000 02:28:55 +0000 (02:28 +0000)]
Repair memory leaks that caused CacheCxt to grow without bound. We
really ought to fix relcache entry construction so that it does not
do so much with CurrentMemoryContext = CacheCxt. As is, relatively
harmless leaks in either sequential or index scanning translate to
permanent leaks if they occur when called from relcache build.
For the moment, however, the path of least resistance is to repair
all such leaks...
Tom Lane [Sun, 21 May 2000 02:23:30 +0000 (02:23 +0000)]
Add debug code to aid in memory-leak tracking: if SHOW_MEMORY_STATS is
defined then statistics about memory usage of all the global memory
contexts are printed after each commit.