Commit Graph

1050 Commits

Author SHA1 Message Date
Bruce Momjian 946e80c435 Final #include cleanup. 2000-06-15 04:10:30 +00:00
Bruce Momjian df43800fc8 Clean up #include's. 2000-06-15 03:33:12 +00:00
Bruce Momjian 7fe8722295 Add () around define -1. 2000-06-14 18:59:42 +00:00
Peter Eisentraut 44d1abebb4 Big warnings cleanup for Solaris/GCC. Down to about 40 now, but
we'll get there one day.

Use `cat' to create aclocal.m4, not `aclocal'. Some people don't
have automake installed.

Only run the autoconf rule in the top-level GNUmakefile if the
invoker specified `make configure', don't run it automatically
because of CVS timestamp skew.
2000-06-14 18:18:01 +00:00
Tom Lane ff7b9f5541 I had overlooked the fact that some fmgr-callable functions return void
--- ie, they're only called for side-effects.  Add a PG_RETURN_VOID()
macro and use it where appropriate.  This probably doesn't change the
machine code by a single bit ... it's just for documentation.
2000-06-14 05:24:50 +00:00
Tom Lane f2d1205322 Another batch of fmgr updates. I think I have gotten all old-style
functions that take pass-by-value datatypes.  Should be ready for
port testing ...
2000-06-13 07:35:40 +00:00
Bruce Momjian 332f0f5fc0 Rename rule CURRENT to OLD in source tree. Add mapping for backward
compatiblity with old rules.
2000-06-12 19:40:58 +00:00
Tom Lane 936900074d Update rule dumper for the brave new world of ONLY. 2000-06-10 05:17:23 +00:00
Bruce Momjian dbf2fd2e0f The enclosed patch changes the behaviour of the "ordinal" ('TH') format for
to_char.  I don't know about the rest of the world, but the "standard" in
Australia is the following:

        1st, 2nd, 3rd, 4th - 9th
        10th - 19th
        21st, 22nd, 23rd, 24th - 29th (similarly for 30s - 90s)
        110th - 119th (and for all "teens")
        121st, 122nd, 123rd, 124th - 129th

I think you see the trend.  The current code works fine except that it
produces:

        111st, 112nd, 113rd, 114th - 119th
        211st, 212nd, 213rd, 214th - 219th ... and so on.

Without knowing anything about what's supported (and what isn't) in the usual
I18N libraries, should this type of behaviour be defined within the locales?

Daniel Baldoni
2000-06-09 03:18:34 +00:00
Tom Lane 7fca3f0379 Cleanup to ensure good state of derived files in tarballs. 2000-06-09 02:38:36 +00:00
Tom Lane ae526b4070 Another round of updates for new fmgr, mostly in the datetime code. 2000-06-09 01:11:16 +00:00
Bruce Momjian 20ad43b576 Mark functions as static and ifdef NOT_USED as appropriate. 2000-06-08 22:38:00 +00:00
Bruce Momjian 5690933d6c Mark ImmediateSharedRelationCacheInvalidate as NOT_USED. 2000-06-08 19:51:06 +00:00
Peter Eisentraut e3059fc0f5 Gen_fmgrtab.sh is strange: it is a platform dependent way (because it uses
CPP) to create platform independent files. Unfortunately, that means that
every config.status (or configure) run invariably causes a relink of the
postmaster and also that we can't put these files in the distribution
(usefully). So we make it a little smarter: when the output files already
exist and it notices that it would recreate them in identical form, it
doesn't touch them. In order to avoid re-running the make rule all the time
we update a timestamp file instead.

Update release_prep accordingly. Also make Gen_fmgrtab.sh use the awk that
is detected at configure time, not necessarily named `awk' and have it check
for exit statuses a little better.

In other news... Remove USE_LOCALE from the templates, it was set to `no'
everywhere anyway. Also remove YACC and YFLAGS from the templates, configure
is smart enough to find bison or yacc itself. Use AC_PROG_YACC for that
instead of the hand-crafted code. Do not set YFLAGS to `-d'. The make rules
that need this flag should explicitly invoke it. YFLAGS should be a user
variable. Update the makefiles to that effect.
2000-06-07 16:27:00 +00:00
Bruce Momjian 7d301947e5 Re-order pg_listener index so it can later be used in an index scan. 2000-06-07 04:09:44 +00:00
Bruce Momjian 4bd5006812 Add index on pg_index.indrelid for Tom Lane. 2000-06-07 02:44:40 +00:00
Tom Lane 42ad25fcd1 init_fcache was being careless about using SearchSysCacheTuple result
over multiple lookups --- it should use SearchSysCacheTupleCopy instead.
This accounts for rare failures like 'init_fcache: null probin for procedure 481'
when running concurrently with a VACUUM.
2000-06-06 17:44:25 +00:00
Tom Lane e57e991e80 Improve comments for SearchSysCacheTuple and SearchSysCacheTupleCopy. 2000-06-06 17:02:38 +00:00
Tom Lane 48165ec226 Latest round of fmgr updates. All functions with bool,char, or int2
inputs have been converted to newstyle.  This should go a long way towards
fixing our portability problems with platforms where char and short
parameters are passed differently from int-width parameters.  Still
more to do for the Alpha port however.
2000-06-05 07:29:25 +00:00
Peter Eisentraut 0a54de8faf Removed ELOG_TIMESTAMPS #define in favor of two run-time
configuration options `Log_timestamp' and `Log_pid'.
2000-06-04 15:06:34 +00:00
Peter Eisentraut 209aa77d98 New ps display code, works on more platforms.
Install a default configuration file.

Clean up some funny business in the config file code.
2000-06-04 01:44:38 +00:00
Bruce Momjian cc2b5e5815 Remove NT-specific file open defines by defining our own open macros for
"rb" and "wb".
2000-06-02 15:57:44 +00:00
Tom Lane bff5dce993 Correct portability problem introduced by yours truly --- I used a
conditional expression x?y:z in an awk program.  Seems old versions
of awk don't have that ...
2000-06-02 02:00:28 +00:00
Tom Lane a82471f9e4 Keep CVS quiet about derived file guc-file.c. 2000-06-02 00:04:26 +00:00
Bruce Momjian bb8bda3918 The definition for "ProcessConfigFile()" in guc-file.l does not match
the prototype in guc.h.  The following patch corrects that.

Billy G. Allie
2000-06-01 16:46:50 +00:00
Tom Lane 64b4a48ddc Simplify overly-clever Make rule, which evidently confuses at least
some versions of gmake (mine didn't do the right thing, anyway).
2000-06-01 14:52:25 +00:00
Peter Eisentraut 6a68f42648 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).

Added to configure an --enable-syslog option.

changed all callers from TPRINTF to elog(DEBUG)
2000-05-31 00:28:42 +00:00
Tom Lane 0f1e39643d 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 ...
2000-05-30 04:25:00 +00:00
Bruce Momjian a12a23f0d0 Remove unused include files. Do not touch /port or includes used by defines. 2000-05-30 00:49:57 +00:00
Tom Lane 6ed00fee53 Convert array_map to use new fmgr interface. 2000-05-29 21:02:32 +00:00
Tom Lane a030113197 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.
2000-05-29 20:18:30 +00:00
Tom Lane 22a517a40c 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.
2000-05-29 19:16:57 +00:00
Tom Lane 091126fa28 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.
2000-05-29 05:45:56 +00:00
Tom Lane 18952f6744 Second round of fmgr changes: triggers are now invoked in new style,
CurrentTriggerData is history.
2000-05-29 01:59:17 +00:00
Tom Lane 305d3ce576 Install fmgr rewrite doc as README file.
Need to update user docs still ...
2000-05-28 18:06:55 +00:00
Tom Lane 0a7fb4e918 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.
2000-05-28 17:56:29 +00:00
Tom Lane b71761d280 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 ...
2000-05-26 17:19:15 +00:00
Tatsuo Ishii 23b0387a94 Fix too long syslog message problem 2000-05-26 12:17:48 +00:00
Bruce Momjian 0460f0502b 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).

Thanks,
Neal Norwitz
2000-05-22 02:34:23 +00:00
Tom Lane 9dab9ab5e4 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...
2000-05-21 02:28:55 +00:00
Tom Lane aa16179118 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.
2000-05-21 02:23:30 +00:00
Tom Lane 25a7a7f446 Clean up grotty references to CacheCxt (externs inside functions,
duplicate global declarations, no points for style at all!)
2000-05-20 23:11:29 +00:00
Tatsuo Ishii 1a6daef70d Enhance multibyte support.
SJIS UDC (NEC selection IBM kanji) support contributed by Eiji Tokuya
2000-05-20 13:12:26 +00:00
Bruce Momjian a47e20b049 Several compilation and run-time problems occur when building on SGI
IRIX systems using the native compilers.  A summary is:
- Various files use "//" as a comment delimiter in c files.
- Problems caused by assuming "char" is signed.
  cash.in: building -signed the rules regression test fails as described
    in FAQ_QNX4.  If CHAR_MAX is "255U" then ((signed char)CHAR_MAX) is -1.
  postmaster.c: random number regression test failed without this change.
- Some generic build issues and warning message cleanup.

David Kaelbling
2000-05-16 20:48:52 +00:00
Tom Lane 6dd06737ba Remove configure check for how to abbreviate 'tr A-Z a-z', and instead
just use the portable form,
tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
There were a bunch of places that weren't paying attention to configure's
result anyway (including configure itself!?); clean them up too.
2000-05-16 02:14:15 +00:00
Tom Lane e8e7b6305a Tweak selectivity for area-based operators. Still a crock... 2000-05-13 06:04:46 +00:00
Tom Lane 3bd03b3803 Make the indexes on pg_group be shared system relations. 2000-05-05 03:09:43 +00:00
Tatsuo Ishii 832877e95a Modify getdatabaseencoding(), pg_encoding_to_char()
pg_char_to_encoding() in multibyte disbaled case so that it does not
throw an error, rather return HARD CODED default value (currently SQL_ASCII).
This would solve the "non-mb backend vs. mb-enabled frontend" problem.
2000-05-02 08:13:08 +00:00
Tom Lane 87e701b8d5 Clean up const-vs-not-const compiler warning in MULTIBYTE code.
'Twas my fault, I think.
2000-04-20 22:40:18 +00:00
Tom Lane 82849df6c6 Add new selectivity estimation functions for pattern-matching operators
(LIKE and regexp matches).  These are not yet referenced in pg_operator,
so by default the system will continue to use eqsel/neqsel.
Also, tweak convert_to_scalar() logic so that common prefixes of strings
are stripped off, allowing better accuracy when all strings in a table
share a common prefix.
2000-04-16 04:41:03 +00:00
Tom Lane 4ca7d148cb elog(NOTICE) during COPY incorrectly reset lineno to 0, causing any
subsequent elogs() in the same COPY operation to display the wrong
line number.  Fix is to clear lineno only when elog level is such
that we will not return to caller.
2000-04-15 19:13:08 +00:00
Thomas G. Lockhart d221e149b4 Fix (well, add) support for ISO "week" in date_part(). Needed for ODBC.
Fix spelling of "millennium".
 Thanks to Mika Nystrom <mika@camembert.cs.caltech.edu> for spotting this.
2000-04-14 15:22:10 +00:00
Bruce Momjian 52f77df613 Ye-old pgindent run. Same 4-space tabs. 2000-04-12 17:17:23 +00:00
Bruce Momjian a447ae2221 The constant in backend/utils/misc/trace.c, line 32 limits the length of
logged queries to 1024, truncating longer queries.  That is about half of
the size I need (I have a union that is 2K long).  Can someone consider
bumping it to 4K or so?  Patch attached...

Regards,
Ed Loehr
2000-04-10 19:25:29 +00:00
Tom Lane 9c38a8d296 Further tweaking of indexscan cost estimates. 2000-04-09 04:31:37 +00:00
Thomas G. Lockhart 0337938fbf Add zpbit and varbit data types from Adrian Joubert
<a.joubert@albourne.com>.
2000-04-08 02:13:11 +00:00
Bruce Momjian 28fb1c196b Update create_rule manual page. 2000-04-07 19:17:51 +00:00
Thomas G. Lockhart a349733bbb Add transcendental math functions (sine, cosine, etc)
Add a random number generator and seed setter (random(), SET SEED)
Fix up the interval*float8 math to carry partial months
 into the time field.
Add float8*interval so we have symmetry in the available math.
Fix the parser and define.c to accept SQL92 types as field arguments.
Fix the parser to accept SQL92 types for CREATE TYPE, etc. This is
 necessary to allow...
Bit/varbit support in contrib/bit cleaned up to compile and load
 cleanly. Still needs some work before final release.
Implement the "SOME" keyword as a synonym for "ANY" per SQL92.
Implement ascii(text), ichar(int4), repeat(text,int4) to help
 support the ODBC driver.
Enable the TRUNCATE() function mapping in the ODBC driver.
2000-04-07 13:40:45 +00:00
Tom Lane 14bc951d30 Fix low-probability bug in relcache startup: write_irels wrote the
pg_internal.init file in-place, which meant that if another backend
started at about the same time, it might read the incomplete file.
init_irels tries to guard against that, but I have now seen a crash
due to reading bad data from a partly-written file.  (This may indicate
a kernel bug on my platform?  Not sure.)  Anyway, clearly the safest
course is to write the new pg_internal.init file under a unique temporary
filename, and rename it into place only after it's all written.
2000-03-31 19:39:22 +00:00
Tom Lane e55985d3be Tweak indexscan cost estimation: round estimated # of tuples visited up
to next integer.  Previously, if selectivity was small, we could compute
very tiny scan cost on the basis of estimating that only 0.001 tuple
would be fetched, which is silly.  This naturally led to some rather
silly plans...
2000-03-30 00:53:30 +00:00
Thomas G. Lockhart 1b113a23e5 Change rules for interpreting date/time input to disallow 1 and 3 character
years. Rejects dates like '0.085', which were accepted previously.
2000-03-29 03:57:18 +00:00
Tom Lane eca02fee2c Rename bytea functions to not have upper-case letters in their names.
Clean up grotty coding in them, too.  AFAICS from the CVS logs, these
have been broken since Postgres95, so I'm not going to insist on an
initdb to fix them now...
2000-03-24 02:41:46 +00:00
Tom Lane 5c63975504 Float-to-int conversion functions should return NULL when given NULL
input, not throw a gratuitous elog().
2000-03-23 07:40:00 +00:00
Tom Lane cad764f349 Improve selectivity estimation involving string constants: pay attention
to more than one character, and try to do the right thing in non-ASCII
locales.
2000-03-23 00:55:42 +00:00
Bruce Momjian 2216584bcf Reverse out BYTEA type coersion. 2000-03-20 15:42:47 +00:00
Bruce Momjian 7f116a6b83 Update for BYTEAOID. 2000-03-20 04:26:01 +00:00
Bruce Momjian 0e1f485f5f Add compatiblity information for bytea. 2000-03-20 04:02:47 +00:00
Tom Lane b178865891 cash_words_out function truncated its output by 1 character due to
incorrect use of StrNCpy.
2000-03-19 22:10:52 +00:00
Tom Lane f91dd7880f Clean up minor compiler warnings. 2000-03-18 18:57:16 +00:00
Tom Lane 341b328b18 Fix a bunch of minor portability problems and maybe-bugs revealed by
running gcc and HP's cc with warnings cranked way up.  Signed vs unsigned
comparisons, routines declared static and then defined not-static,
that kind of thing.  Tedious, but perhaps useful...
2000-03-17 02:36:41 +00:00
Thomas G. Lockhart 9e7166096e Support full POSIX-style time zone: EST+3, PST-3, etc.
We probably support a superset of the spec, but I don't have the spec
 to confirm this.
Update regression tests to include tests for this format.
2000-03-16 14:38:42 +00:00
Bruce Momjian 4a3a1e2cf1 Hi,
small changes in formatting.c code (better memory usage ...etc.) and
better
to_char's cache (will fastly for more to_char()s in one query).

(It is probably end of to_char() development in 7.0 cycle.)

                                                Karel
2000-03-16 01:35:41 +00:00
Tom Lane 6358e654ca Update comment obsoleted by Thomas's latest fixes. 2000-03-15 23:42:14 +00:00
Tom Lane 77f4885393 Fix busted TRANSLATE() code --- it coredumped due to pfree()'ing the
wrong pointer.
2000-03-15 17:24:18 +00:00
Thomas G. Lockhart 6456810078 Implement column aliases on views "CREATE VIEW name (collist)".
Implement TIME WITH TIME ZONE type (timetz internal type).
Remap length() for character strings to CHAR_LENGTH() for SQL92
 and to remove the ambiguity with geometric length() functions.
Keep length() for character strings for backward compatibility.
Shrink stored views by removing internal column name list from visible rte.
Implement min(), max() for time and timetz data types.
Implement conversion of TIME to INTERVAL.
Implement abs(), mod(), fac() for the int8 data type.
Rename some math functions to generic names:
 round(), sqrt(), cbrt(), pow(), etc.
Rename NUMERIC power() function to pow().
Fix int2 factorial to calculate result in int4.
Enhance the Oracle compatibility function translate() to work with string
 arguments (from Edwin Ramirez).
Modify pg_proc system table to remove OID holes.
2000-03-14 23:06:59 +00:00
Tom Lane e631df3c1b Extend numeric_round and numeric_trunc to accept negative scale inputs
(ie, allow rounding to occur at a digit position left of the decimal
point).  Apparently this is how Oracle handles it, and there are
precedents in other programming languages as well.
2000-03-13 02:31:13 +00:00
Tom Lane 57cf09591b Remove unnecessary limitations on lengths of bpchar and varchar constants.
Since we detect oversize tuples elsewhere, I see no reason not to allow
string constants that are 'too long' --- after all, they might never get
stored in a tuple at all.
2000-03-13 01:54:07 +00:00
Hiroshi Inoue fd9ff86bd9 Trial implementation of ALTER DROP COLUMN.
They are #ifdef'd.
Add -D_DROP_COLUMN_HACK__ compile option
to evaluate it.
2000-03-09 05:00:26 +00:00
Tom Lane 6513946cbb Extend #ifdef CLOBBER_FREED_MEMORY debugging option so that memory
freed wholesale by AllocSetReset() is overwritten too.
2000-03-08 23:42:58 +00:00
Bruce Momjian 26c953e373 Bruce and all:
Here's a patch to fix the " '.' not allowed in db path" problem I ran into.
I removed '.' from the set of illegial characters, but added backtick. I also
included an explicit test for attempting include a reference to a parent dir.

How that?

Ross
2000-03-08 01:46:47 +00:00
Bruce Momjian ab7fd11846 Reversed out inet patch. 2000-03-08 01:44:37 +00:00
Bruce Momjian eae5184d11 Hi,
the to_char() source code is large, here are regression tests for
numeric/timestamp/int8 part. It is probably enough test for formatting
code in the formatting.c module. The others (float4/float8/int4) types
share this formatting code and eventual bugs for these types aren't
few probable.

 Patch fix timestamp_to_char() for infinity/invalid timestamp too.


                                                Karel
2000-03-08 01:34:41 +00:00
Bruce Momjian 0c5422912e Protects you from coredumps if you do eg. str::int4 where str is a text
field. cf. Tom Lane's <19021.950544016@sss.pgh.pa.us> 14 Feb hackers
message.

Cheers,

Patrick Welche
2000-03-07 23:58:38 +00:00
Bruce Momjian 52d39d519a Sorting for the inet data type randomly returns the wrong result
when you have networks with the same prefix, but different netmasks.

This is due to the fact that occassionally there is random
(uninitialized?)
data in the extra bits past the point where the netmask cares about
them.

ie (real data from a real live database):

  10.0/10 == 00001010.00100000.00100000.00011000
  10.0/11 == 00001010.00000000.00000000.00000000
                        ^ Bad data, normally never seen

The v4bitncmp() function was only taking one bit length argument so
it would determine that the networks were different, even though
they really aren't (and the netmask test wouldn't be used).  This
ONLY happens if the tuple with the longer bit length is used as the
ip_bits() for the v4bitncmp call AND there happens to be junk data
in place in the shorter tuple.  Odd and random, but I saw it happen
a couple times so...


Ryan Mooney
2000-03-07 23:01:43 +00:00
Tom Lane 73dd716285 Small performance improvement in comparetup_heap. 2000-03-01 17:14:09 +00:00
Jan Wieck 75133d9a46 Reactivated LZTEXT data type and changed rule plan- and qual-strings
into lztext.

Jan
2000-02-27 12:02:34 +00:00
Tom Lane f884130241 Minor improvements in regprocout() and oidvectortypes(). 2000-02-27 03:30:27 +00:00
Tom Lane aff830a760 Add date and time datatype handling to convert_to_scalar. (I was waiting
for Thomas to do the datetime consolidation before touching this, but
it's done now...)
2000-02-26 23:03:12 +00:00
Tom Lane baeef0e172 Change rule dumper to produce reasonable output for casts that assign
a specific length or precision, such as foo::char(8).  Remove erroneous
removal of user-written casts at the top level of a SELECT target item.
2000-02-26 21:13:18 +00:00
Tom Lane 08b1040374 Shared-memory hashtables have non-extensible directories, which means
it's a good idea to choose the directory size based on the expected
number of entries.  But ShmemInitHash was using a hard-wired constant.
Boo hiss.  This accounts for recent report of postmaster failure when
asking for 64K or more buffers.
2000-02-26 05:25:55 +00:00
Tom Lane 9110b33f46 Add numeric <-> int8 and numeric <-> int2 conversion functions, as well
as a unary minus operator for numeric.  Now that long numeric constants
will get converted to NUMERIC in early parsing, it's essential to have
numeric->int8 conversion to avoid 'can't convert' errors on undecorated
int8 constants.  Threw in the rest for completeness while I was in the
area.
I did not force an initdb for this, since the system will still run
without the new pg_proc/pg_operator entries.  Possibly I should've.
2000-02-24 02:05:30 +00:00
Tom Lane 399a570fe2 int8in failed to detect overflow; it really should. 2000-02-24 01:54:40 +00:00
Tom Lane e1a95def8b Quick hack solution so that pg_dump of views works. Needs repair after
Thomas gets back, but better this than nonfunctional pg_dump in the beta.
2000-02-21 20:18:11 +00:00
Tom Lane fc8e6c7746 Oops, commited a test version of this file by accident. Revert. 2000-02-21 18:49:54 +00:00
Tom Lane 393f313227 Change parse-time representation of float literals (which include oversize
integers) to be strings instead of 'double'.  We convert from string form
to internal representation only after type resolution has determined the
correct type for the constant.  This eliminates loss-of-precision worries
and gets rid of the change in behavior seen at 17 digits with the
previous kluge.
2000-02-21 18:47:12 +00:00
Tom Lane d8cedf67ad Clean up some really grotty coding in catcache.c, improve hashing
performance in catcache lookups.
2000-02-21 03:36:59 +00:00
Tom Lane 57b30e8e22 Create a new expression node type RelabelType, which exists solely to
represent the result of a binary-compatible type coercion.  At runtime
it just evaluates its argument --- but during type resolution, exprType
will pick up the output type of the RelabelType node instead of the type
of the argument.  This solves some longstanding problems with dropped
type coercions, an example being 'select now()::abstime::int4' which
used to produce date-formatted output, not an integer, because the
coercion to int4 was dropped on the floor.
2000-02-20 21:32:16 +00:00
Hiroshi Inoue e3a97b370c Implement reindex command 2000-02-18 09:30:20 +00:00
Tom Lane 8cb624262a Replace inefficient _bt_invokestrat calls with direct calls to the
appropriate btree three-way comparison routine.  Not clear why the
three-way comparison routines were being used in some paths and not
others in btree --- incomplete changes by someone long ago, maybe?
Anyway, this makes for a nice speedup in CREATE INDEX.
2000-02-18 06:32:39 +00:00
Tom Lane 598ea2c359 Finish repairing 6.5's problems with r-tree indexes: create appropriate
selectivity functions and make the r-tree operators use them.  The
estimation functions themselves are just stubs, unfortunately, but
perhaps someday someone will make them compute realistic estimates.
Change pg_am so that the optimizer can reliably tell the difference
between ordered and unordered indexes --- before it would think that
an r-tree index can be scanned in '<<' order, which is not right AFAIK.
Repair broken negator links for network_sup and related ops.
Initdb forced.  This might be my last initdb force for 7.0 ... hope so
anyway ...
2000-02-17 03:40:02 +00:00
Thomas G. Lockhart bf566b202e All regression tests pass except for rules.sql (unrelated).
Implement "date/time grand unification".
 Transform datetime and timespan into timestamp and interval.
 Deprecate datetime and timespan, though translate to new types in gram.y.
 Transform all datetime and timespan catalog entries into new types.
 Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
 Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
  routines for all date/time types.
 date.{h,c} now deals with date, time types.
 timestamp.{h,c} now deals with timestamp, interval types.
 nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:17:02 +00:00
Thomas G. Lockhart 41f1f5b76a Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
 Deprecate datetime and timespan, though translate to new types in gram.y.
 Transform all datetime and timespan catalog entries into new types.
 Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
 Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
  routines for all date/time types.
 date.{h,c} now deals with date, time types.
 timestamp.{h,c} now deals with timestamp, interval types.
 nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 17:26:26 +00:00
Thomas G. Lockhart c97672b083 Make ISO date style (e.g. "2000-02-16 09:33") the default.
Implement "date/time grand unification".
 Transform datetime and timespan into timestamp and interval.
 Deprecate datetime and timespan, though translate to new types in gram.y.
 Transform all datetime and timespan catalog entries into new types.
 Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
 Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
  routines for all date/time types.
 date.{h,c} now deals with date, time types.
 timestamp.{h,c} now deals with timestamp, interval types.
 nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 17:25:49 +00:00
Tom Lane 68be513f8b If we don't have any stats for a boolean column, assume
the disbursion is 0.5, not something small.
2000-02-16 01:00:23 +00:00
Tom Lane deee4e1612 Make eqsel produce better results for boolean columns,
and make scalarltsel a little more forgiving at the boundaries of the
known range of a column value.
2000-02-16 00:59:27 +00:00
Tom Lane b1577a7c78 New cost model for planning, incorporating a penalty for random page
accesses versus sequential accesses, a (very crude) estimate of the
effects of caching on random page accesses, and cost to evaluate WHERE-
clause expressions.  Export critical parameters for this model as SET
variables.  Also, create SET variables for the planner's enable flags
(enable_seqscan, enable_indexscan, etc) so that these can be controlled
more conveniently than via PGOPTIONS.

Planner now estimates both startup cost (cost before retrieving
first tuple) and total cost of each path, so it can optimize queries
with LIMIT on a reasonable basis by interpolating between these costs.
Same facility is a win for EXISTS(...) subqueries and some other cases.

Redesign pathkey representation to achieve a major speedup in planning
(I saw as much as 5X on a 10-way join); also minor changes in planner
to reduce memory consumption by recycling discarded Path nodes and
not constructing unnecessary lists.

Minor cleanups to display more-plausible costs in some cases in
EXPLAIN output.

Initdb forced by change in interface to index cost estimation
functions.
2000-02-15 20:49:31 +00:00
Tom Lane 4c2071c8bf Repair bogus rule display of attr lists. 2000-02-15 08:24:12 +00:00
Thomas G. Lockhart a344a6e7b5 Carry column aliases from the parser frontend. Enables queries like
SELECT a FROM t1 tx (a);
Allow join syntax, including queries like
  SELECT * FROM t1 NATURAL JOIN t2;
Update RTE structure to hold column aliases in an Attr structure.
2000-02-15 03:38:29 +00:00
Thomas G. Lockhart 929e50ece8 Recognize special case of POSIX time zone: "GMT+8" and "GMT-8".
Still needs to be done for the general case:
 "tz+/-#" where tz is a 3 char string.
This will probably involve moving code around to other places.
2000-02-15 03:17:09 +00:00
Bruce Momjian a2226ad237 contrib-array.patch
this is an old patch which I have already submitted and never seen
        in the sources. It corrects the datatype oids used in some iterator
        functions. This bug has been reported to me by many other people.

contrib-datetime.patch

        some code contributed by Reiner Dassing <dassing@wettzell.ifag.de>

contrib-makefiles.patch

        fixes all my contrib makefiles which don't work with some compilers,
        as reported to me by another user.

contrib-miscutil.patch

        an old patch for one of my old contribs.

contrib-string.patch

        a small change to the c-like text output functions. Now the '{'
        is escaped only at the beginning of the string to distinguish it
        from arrays, and the '}' is no more escaped.

elog-lineno.patch

        adds the current lineno of CopyFrom to elog messages. This is very
        useful when you load a 1 million tuples table from an external file
        and there is a bad value somehere. Currently you get an error message
        but you can't know where is the bad data. The patch uses a variable
        which was declared static in copy.c. The variable is now exported
        and initialized to 0. It is always cleared at the end of the copy
        or at the first elog message or when the copy is canceled.
        I know this is very ugly but I can't find any better way of knowing
        where the copy fails and I have this problem quite often.

plperl-makefile.patch

        fixes a typo in a makefile, but the error must be elsewhere because
        it is a file generated automatically. Please have a look.

tprintf-timestamp.patch

        restores the original 2-digit year format, assuming that the two
        century digits don't carry much information and that '000202' is
        easier to read than 20000202. Being only a log file it shouldn't
        break anything.

Please apply the patches before the next scheduled code freeze.

I also noticed that some of the contribs don't compile correcly. Should we
ask people to fix their code or rename their makefiles so that they are
ignored by the top makefile?

--
Massimo Dal Zotto
2000-02-13 18:59:53 +00:00
Bruce Momjian 7528fd2d52 Add btree indexing of boolean values
Don Baccus
2000-02-10 19:51:52 +00:00
Bruce Momjian 394af52795 I'm sending patch with new version of to_char numbers formatting.
The PostgreSQL's to_char() is very compatible with Oracle's to_char
 now. I hope that to_char's 3000 rows of source is without bugs, but
 will good if anyone test it, for me it works very well :-)


                                                        Karel

----------------------------------------------------------------------
Karel Zak <zakkr@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/
2000-02-08 15:57:01 +00:00
Jan Wieck f59daf80f7 Added complete MATCH <unspecified> support contributed by Don Baccus.
Jan
2000-02-07 17:50:38 +00:00
Tom Lane b64826a47d Squash longstanding memory leak: when catcache.c copied a tuple into
the cache context, it didn't bother to free the tuple that
CatalogIndexFetchTuple had allocated in the transaction context.
Do enough cache lookups in the same xact, and you start to notice...
2000-02-04 03:16:03 +00:00
Tom Lane a152ebeec6 Fix problems seen in parallel regress tests when SI buffer overruns (causing
syscache and relcache flushes).  Relcache entry rebuild now preserves
original tupledesc, rewrite rules, and triggers if possible, so that pointers
to these things remain valid --- if these things change while relcache entry
has positive refcount, we elog(ERROR) to avoid later crash.  Arrange for
xact-local rels to be rebuilt when an SI inval message is seen for them,
so that they are updated by CommandCounterIncrement the same as regular rels.
(This is useful because of Hiroshi's recent changes to process our own SI
messages at CommandCounterIncrement time.)  This allows simplification of
some routines that previously hacked around the lack of an automatic update.
catcache now keeps its own copy of tupledesc for its relation, rather than
depending on the relcache's copy; this avoids needing to reinitialize catcache
during a cache flush, which saves some cycles and eliminates nasty circularity
problems that occur if a cache flush happens while trying to initialize a
catcache.
Eliminate a number of permanent memory leaks that used to happen during
catcache or relcache flush; not least of which was that catcache never
freed any cached tuples!  (Rule parsetree storage is still leaked, however;
will fix that separately.)
Nothing done yet about code that uses tuples retrieved by SearchSysCache
for longer than is safe.
2000-01-31 04:35:57 +00:00
Tom Lane 04103e00f1 Modify uses of RelationFlushRelation and RelationCacheInvalidate so that
we *always* rebuild, rather than deleting, an invalidated relcache entry
that has positive refcount.  Otherwise an SI cache overrun leads to
dangling Relation pointers all over the place!
2000-01-29 19:51:59 +00:00
Bruce Momjian 02d83c4475 Add include for float.h. 2000-01-26 06:33:49 +00:00
Bruce Momjian 5c25d60244 Add:
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc

to all files copyright Regents of Berkeley.  Man, that's a lot of files.
2000-01-26 05:58:53 +00:00
Bruce Momjian b866d2e2d7 as attache of this mail is patch (to the main tree) with to_char's
family functions. Contain:

  conversion from a datetype to formatted text:

	to_char( datetime, 	text)
	to_char( timestamp,	text)
	to_char( int4,		text)
	to_char( int8,		text)
	to_char( float4,	text)
	to_char( float8,	text)
	to_char( numeric,	text)

  vice versa:

	to_date		( text, text)
	to_datetime	( text, text)
	to_timestamp	( text, text)
	to_number	( text, text)	   (convert to numeric)


  PostgreSQL to_char is very compatible with Oracle's to_char(), but not
total exactly (now). Small differentions are in number formating. It will
fix in next to_char() version.


! If will this patch aplly to the main tree, must be delete the current
  to_char version in contrib (directory "dateformat" and note in contrib's
  README), this patch not erase it (sorry Bruce).



The patch patching files:

	doc/src/sgml/func.sgml
                     ^^^^^^^^
   Hmm, I'm not sure if my English... :( Check it anyone (volunteer)?

   Thomas, it is right? SGML is not my primary lang  and compile
   the current PG docs tree is very happy job (hard variables setting in
   docs/sgml/Makefile --> HSTYLE= /home/users/t/thomas/....  :-)

   What add any definition to global configure.in and set Makefiles in docs
   tree via ./configure?

	src/backend/utils/adt/Makefile
	src/backend/utils/adt/formatting.c
	src/include/catalog/pg_proc.h
	src/include/utils/formatting.h
Karel Zak <zakkr@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/
2000-01-25 23:53:56 +00:00
Tatsuo Ishii 6f843e8dd8 Fix pg_euccn_mblen() so that it always returns 2 if data is not ascii.
(EUC_CN does have only code set 0 and 1)
2000-01-25 02:12:27 +00:00
Tom Lane 0dbffa704a First cut at making useful selectivity estimates for range queries
(ie, WHERE x > lowbound AND x < highbound).  It's not very bright yet
but it does something useful.  Also, rename intltsel/intgtsel to
scalarltsel/scalargtsel to reflect usage better.  Extend convert_to_scalar
to do something a little bit useful with string data types.  Still need
to make it do something with date/time datatypes, but I'll wait for
Thomas's datetime unification dust to settle first.  Eventually the
routine ought not have any type-specific knowledge at all; it ought to
be calling a type-dependent routine found via a pg_type column; but
that's a task for another day.
2000-01-24 07:16:52 +00:00
Bruce Momjian 8bcac56086 Update for index change. Semes it didn't work the first time. 2000-01-24 03:08:27 +00:00
Bruce Momjian da5aba105f Remove Ops parameter from STATRELID cache lookup, for Tom Lane and
optimizer.
2000-01-24 02:12:58 +00:00
Tatsuo Ishii cfe717714c char_length()/octet_length for char() type now returns length of
the charcter including trailing blanks.
2000-01-23 08:13:34 +00:00
Tom Lane 27fee810ff Replace SearchSysCacheGetAttribute with SysCacheGetAttr, which fetches
an attribute of a tuple previously fetched with SearchSysCacheTuple.
This avoids a lot of redundant cache lookups, particularly in selfuncs.c.
Also, remove SearchSysCacheStruct, which was unused and grotty.
2000-01-23 03:43:24 +00:00
Tom Lane 8449df8a67 First cut at unifying regular selectivity estimation with indexscan
selectivity estimation wasn't right.  This is better...
2000-01-23 02:07:00 +00:00
Tom Lane 71ed7eb494 Revise handling of index-type-specific indexscan cost estimation, per
pghackers discussion of 5-Jan-2000.  The amopselect and amopnpages
estimators are gone, and in their place is a per-AM amcostestimate
procedure (linked to from pg_am, not pg_amop).
2000-01-22 23:50:30 +00:00
Peter Eisentraut fa5400c0a4 added ALTER TABLE DROP COLUMN, early version 2000-01-22 14:20:56 +00:00
Tom Lane 08195a43f3 Fix bugs in NUMERIC ceil() and floor() functions. ceil(0) returned 1,
and both would insert random junk digits if given an input that was an
exact multiple of 10.
2000-01-20 02:21:44 +00:00
Bruce Momjian 560e196bdd The latest source does not compile on Solaris 7 due to
a missing include from a modified file.

Here is a patch to fix it:-

Keith Parks.
2000-01-19 14:01:25 +00:00
Peter Eisentraut 533d516629 Removed MBFLAGS from makefiles since it's now done in include/config.h. 2000-01-19 02:59:03 +00:00
Tatsuo Ishii 6c25ea2342 Fix minor comple error 2000-01-18 13:46:10 +00:00
Tatsuo Ishii 716fb90bf6 Fix minor comping errors 2000-01-18 13:44:48 +00:00
Tatsuo Ishii b1e891dbd4 Remove compiler warnings 2000-01-18 05:14:24 +00:00
Tatsuo Ishii 5eb1d0deb1 Add builtin functions:
pg_char_to_encoding()
pg_encoding_to_char()
2000-01-18 05:10:29 +00:00
Tom Lane d58fa7611b numeric_in accepts exponents; numeric to int4 rounds; float4/8 to numeric
is considerably more robust and accurate than it used to be.
Also, get rid of numeric's private allocation freelist, which is no longer
a win since Jan rewrote palloc.
2000-01-18 03:44:41 +00:00
Tom Lane 9e0b463473 setheapoverride() is history. Uses replaced with CommandCounterIncrement()
where necessary --- several of them didn't really need it, though.
tqual-checking macros simplified accordingly.
2000-01-17 23:57:48 +00:00
Tom Lane 3cb8c8da68 Clean up problems with rounding/overflow code in NUMERIC, particularly
the case wherein zero was rejected for a field like NUMERIC(4,4).
Miscellaneous other code beautification efforts.
2000-01-15 23:42:49 +00:00
Tom Lane 584e646ad8 Fix a passel of problems with incorrect calls to typinput and typoutput
functions, which would lead to trouble with datatypes that paid attention
to the typelem or typmod parameters to these functions.  In particular,
incorrect code in pg_aggregate.c explains the platform-specific failures
that have been reported in NUMERIC avg().
2000-01-15 22:43:25 +00:00
Peter Eisentraut 1cd4c14116 Fixed all elog related warnings, as well as a few others. 2000-01-15 02:59:43 +00:00
Peter Eisentraut 4ceb2d0cb6 * User management commands no longer user pg_exec_query_dest -> more robust
* Let unprivileged users change their own passwords.

* The password is now an Sconst in the parser, which better reflects its text datatype and also
forces users to quote them.

* If your password is NULL you won't be written to the password file, meaning you can't connect
until you have a password set up (if you use password authentication).

* When you drop a user that owns a database you get an error. The database is not gone.
2000-01-14 22:11:38 +00:00
Peter Eisentraut 46a28f1b14 Fixed everything in and surrounding createdb and dropdb to make it more
error-proof. Rearranged some old code and removed dead sections.
2000-01-13 18:26:18 +00:00
Tatsuo Ishii 1f9d535aca Add UDC (User Defined Characters) support to SJIS/EUC_JP conversion
Update README so that it reflects all source file names
Add an entry to make sjistest (testing between SJIS/EUC_JP conversion)
2000-01-13 01:08:14 +00:00
Bruce Momjian aadd14b8f2 More cleanups. 2000-01-11 02:46:48 +00:00
Tom Lane bf49f0849d Remove outdated comment about 8 arguments. 2000-01-11 01:42:08 +00:00
Bruce Momjian 182162a388 Update type stuff. 2000-01-10 20:46:23 +00:00
Bruce Momjian dd8b0e67ec Cleanup for func args > 8. 2000-01-10 20:23:31 +00:00
Bruce Momjian 2d920dc717 More updates for function call interface > 8. 2000-01-10 18:27:41 +00:00
Bruce Momjian 0bdd0cdd98 Update fmgr to allow 32 arguments. 2000-01-10 18:18:30 +00:00
Bruce Momjian 8a093d0ae3 Make number of args to a function configurable. 2000-01-10 17:14:46 +00:00