Commit Graph

1050 Commits

Author SHA1 Message Date
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
Bruce Momjian 6456b17bc1 Rename oid8 -> oidvector and int28 -> int2vector. Cleanup of *out functions. 2000-01-10 16:13:23 +00:00
Bruce Momjian 3f03f74f36 Update int28out and out8out and _in_ functions to handle trailing zeros
properly.
2000-01-10 15:41:34 +00:00
Hiroshi Inoue 0f2e7948e2 Improve cache invalidation handling. Eespecially
this would fix TODO
* elog() flushes cache, try invalidating just entries from
  current xact, perhaps using invalidation cache
2000-01-10 06:30:56 +00:00
Bruce Momjian 5770935965 Fix oid8in and int28in for spaces 2000-01-10 05:23:47 +00:00
Bruce Momjian a040281787 Move fixes for >8 indexed fields. 2000-01-10 05:20:26 +00:00
Bruce Momjian b99f300675 Move INDEX_MAX_KEYS to postgres.h, and make it configurable for users. 2000-01-10 04:36:37 +00:00
Tatsuo Ishii 10283ee6a4 Move SetPidFile() and firends to utils/init/miscinit.c from
postmaster/postmaster.c so that
tcop/postgres.c can use them. Now we have an interlock between
postmaster and postgres.
2000-01-09 12:15:57 +00:00
Tom Lane 166b5c1def Another round of planner/optimizer work. This is just restructuring and
code cleanup; no major improvements yet.  However, EXPLAIN does produce
more intuitive outputs for nested loops with indexscans now...
2000-01-09 00:26:47 +00:00
Bruce Momjian 8da88a6f2b Sorry, that I send this letter/patch again, but previous sending is
still
without answer. I want continue with to_char(), but I need any answer
for this patch. Please.

Thank! (and sorry of my impatient :-)
                                                        Karel
2000-01-07 17:22:47 +00:00
Jan Wieck b7b6d4bf53 Changed "triggered data change violation" detection code
in trigger manager.

Jan
2000-01-06 20:47:01 +00:00
Jan Wieck 88016a564a Fixed bug in targetlist expression replacement of
SET DEFAULT referential action triggers.

Jan
2000-01-06 16:30:43 +00:00
Bruce Momjian b78769fda2 Fix it's and its to be correct. 2000-01-05 18:23:54 +00:00
Thomas G. Lockhart 3ec826f99a Repair two recently reported problems:
1) datetime_pl_span() added the seconds field before adding the months
 field.  This lead to erroneous results for e.g.
   select datetime '1999-11-30' + timespan '1 mon - 1 sec';
 Reverse the order of operations to add months first.
2) tm2timespan() did all intermediate math as integer, converting to double
 at the very end. This resulted in hidden overflows when given very large
 integer days, hours, etc. For example,
   select '74565 days'::timespan;
 produced the wrong result. Change code to ensure that doubles are used
 for intermediate calculations.
Thanks to Olivier PRENANT <ohp@pyrenet.fr> and
 Tulassay Zsolt <zsolt@tek.bke.hu> for problem reports and to Tom Lane for
 accurate analyses.
2000-01-04 07:53:27 +00:00
Bruce Momjian aae7b19077 Update DATEDEBUG removal. 2000-01-02 02:32:37 +00:00
Bruce Momjian 7a877dfd2d Remove DATEDEBUG because it didn't look Y2K safe, and fix timestamp elog
to be Y2K safe.
2000-01-02 01:37:28 +00:00
Tom Lane 2784a5aedf Clean up datatypes and comments for op_class() routine. 1999-12-31 03:18:43 +00:00
Tom Lane 8a40400d40 elog() was set up to call abort() if it saw an ERROR or FATAL exit
during InitProcessingMode and the CurrentTransactionState was neither
TRANS_DEFAULT nor TRANS_DISABLED.  Unfortunately, after someone's recent
change to start the transaction manager earlier in startup than it used
to be started, that caused an abort() and consequent database system
reset on quite harmless errors (such as rejecting an invalid user name!).
As far as I can see, the test on CurrentTransactionState was completely
useless anyway, so I've removed it.
1999-12-30 23:03:40 +00:00
Tom Lane 9c95f8c9b2 Repair bugs discussed in pghackers thread of 15 May 1999: creation of a
relcache entry no longer leaks a small amount of memory.  index_endscan
now releases all the memory acquired by index_beginscan, so callers of it
should NOT pfree the scan descriptor anymore.
1999-12-30 05:05:13 +00:00
Jan Wieck e3cec20ccd Removed LZTEXT datatype as discussed.
Jan
1999-12-28 13:40:53 +00:00
Tom Lane 350cb386af Clean up handling of explicit NULL constants. Cases like
SELECT null::text;
	SELECT int4fac(null);
work as expected now.  In some cases a NULL must be surrounded by
parentheses:
	SELECT 2 + null;                 fails
	SELECT 2 + (null);               OK
This is a grammatical ambiguity that seems difficult to avoid.  Other
than that, NULLs seem to behave about like you'd expect.  The internal
implementation is that NULL constants are typed as UNKNOWN (like
untyped string constants) until the parser can deduce the right type.
1999-12-24 06:43:34 +00:00
Hiroshi Inoue a3e2bc732d to live in a transaction before access to db
during backend startup.
1999-12-22 00:07:16 +00:00
Bruce Momjian bb50fb517f This patch will avoid SIGFPE on some geo functions , if PostgreSQL is compiled
with DEC C.

DEC C doesn't handle double values greater than DBL_MAX, but some
PostgreSQL geo functions assign greater than DBL_MAX values to some vars
in some special cases - that couses SIGFPE. I dunno if that is the only place
to fix to work well with DEC C.

Kirill Nosov.
1999-12-21 17:01:44 +00:00
Tom Lane f74b94db09 Finally found a platform which has finite() but nonetheless sets errno
rather than returning a NaN for bogus input to pow().  Namely, HPUX 10.20.
I think this is sufficient evidence for what I thought all along, which
is that the float.c code *must* look at errno whether finite() exists or
not.
1999-12-20 02:15:35 +00:00
Tom Lane 939229904a Clean up some minor gcc warnings. 1999-12-20 01:23:04 +00:00
Jan Wieck 397e9b32a3 Some changes to prepare for LONG attributes.
Jan
1999-12-16 22:20:03 +00:00
Bruce Momjian d033e17530 Ethernet MAC addresses (macaddr type) are not compared correctly for
equality.  The lobits macro is wrong and extracts the wrong set of
bits out of the structure.

To exhibit the problem:

select '000000:000000'::macaddr = '000000:110000'::macaddr ;
?column?
--------
t
(1 row)

Daniel Boyd
1999-12-16 01:30:49 +00:00
Bruce Momjian a82f9ffde6 New LDOUT makefile variable for QNX os. 1999-12-13 22:35:27 +00:00
Tom Lane a8ae19ec3d aggregate(DISTINCT ...) works, per SQL spec.
Note this forces initdb because of change of Aggref node in stored rules.
1999-12-13 01:27:21 +00:00
Jan Wieck 62c42a05a2 Added global variable to have RI triggers override
time qualification of HeapTupleSatisfiesSnapshot()

Jan
1999-12-10 12:34:15 +00:00
Tatsuo Ishii d31ff14ed8 Fix memory overrun while setting ps status 1999-12-10 10:29:01 +00:00
Bruce Momjian 97dec77fab Rename several destroy* functions/tags to drop*. 1999-12-10 03:56:14 +00:00
Bruce Momjian 3ffd3d82db Make LD -r as macros that can be changed for QNX. 1999-12-09 19:15:45 +00:00
Bruce Momjian cb0032cdcf Update for QNX from Kardos, Dr. Andrea 1999-12-09 15:56:16 +00:00
Bruce Momjian d65a27f950 Hi,
I was able to crash postgres 6.5.3 when I did an 'alter user' command.
After I started a debugger I found the problem in the timezone handling
of
datetime (my Linux box lost its timezone information, that's how the
problem occurred).

Only 7 bytes are reserved for the timezone, without checking for
boundaries.

Attached is a patch that fixes this problem and emits a NOTICE if a
timezone is encountered that is longer than MAXTZLEN bytes, like this:

Jeroen van Vianen
1999-12-09 05:02:24 +00:00
Jan Wieck 0882951b0c Fixed concurrent visibility bug.
Jan
1999-12-08 20:41:22 +00:00
Jan Wieck 5ad4034a4c Again updated INSIDE TODO
Jan
1999-12-07 00:13:41 +00:00
Jan Wieck 70dd9e81af Added SET DEFAULT action for ON DELETE/UPDATE
Jan
1999-12-07 00:11:35 +00:00
Jan Wieck 3327730bbd Corrected TODO in source
Jan
1999-12-06 19:52:36 +00:00
Jan Wieck 2eb53e684c Added ON DELETE/UPDATE SET NULL
Jan
1999-12-06 19:50:49 +00:00
Jan Wieck b8ef7e7f82 Completed FOREIGN KEY syntax.
Added functionality for automatic trigger creation during CREATE TABLE.

Added ON DELETE RESTRICT and some others.

Jan
1999-12-06 18:02:47 +00:00
Tom Lane 53311358c2 Rule deparser needs to quote identifiers that are spelled the same as
SQL keywords.
1999-12-06 02:37:17 +00:00
Bruce Momjian c83b4d1cd8 Fix for bool casting. 1999-11-25 19:15:20 +00:00
Jan Wieck 4069d48aa7 Added another single byte oriented decompressor, useful for
comparision functions.

Added all lztext comparision functions, operators and a default
operator class for nbtree on lztext.

Jan
1999-11-25 01:28:07 +00:00
Bruce Momjian 4ae43c84c3 Add opid to selectivity function call. 1999-11-25 00:21:34 +00:00
Bruce Momjian 922e53e6ea Enable pg_statistic cache use. 1999-11-25 00:15:57 +00:00
Bruce Momjian 8f401e8042 Cleanup for pg_statistic commit. 1999-11-24 17:09:28 +00:00
Bruce Momjian 74f418eb9a Add pg_statistic index, add missing Hiroshi file. 1999-11-24 16:52:50 +00:00
Tatsuo Ishii 61a93ed2da Add multi-byte support to lztextlen() 1999-11-24 03:45:12 +00:00
Bruce Momjian 95997e159b Rename heap_replace to heap_update. 1999-11-24 00:58:48 +00:00
Bruce Momjian bb10bf319e Rename heap_replace to heap_update. 1999-11-24 00:44:37 +00:00
Bruce Momjian fc955b14ea Add system indexes to match all caches.
Make all system indexes unique.
Make all cache loads use system indexes.
Rename *rel to *relid in inheritance tables.
Rename cache names to be clearer.
1999-11-22 17:56:41 +00:00
Tom Lane 316c4c57e2 Clean up some problems in error recovery --- elog() was pretty broken
for the case of errors in backend startup, and proc_exit's method for
coping with errors during proc_exit was *completely* busted.  Fixed per
discussions on pghackers around 11/6/99.
1999-11-22 02:06:31 +00:00
Tom Lane 76ccf73f2b Repair problem exposed by Jan's new parallel-regression-test scaffold:
inval.c thought it could safely use the catcache to look up the OIDs of
system relations.  Not good, considering that inval.c could be called
during catcache loading, if a shared-inval message arrives.  Rip out the
lookup logic and instead use the known OIDs from pg_class.h.
1999-11-21 01:58:22 +00:00
Jan Wieck 43499af4ab New parallel regression test shell and related things.
Jan
1999-11-19 18:51:52 +00:00
Jan Wieck 73bfcf6b22 Changed pg_rewrite attributes ev_qual and ev_action to the new
compressed lztext data type.

Jan
1999-11-18 13:56:30 +00:00
Bruce Momjian 1276aef2f5 Fix problem with temp tables shown in regression test by Jan. 1999-11-17 23:51:21 +00:00
Jan Wieck 211ed36635 Some minor corrections to the LZ compression. In fact I wanted to
HAVE the required OID's first.

Jan
1999-11-17 22:18:46 +00:00
Jan Wieck 79c3b71c1b The new LZ compression and an lztext data type based on it.
Jan
1999-11-17 21:21:51 +00:00
Bruce Momjian ddc335290c Fix lookup of temp table names that I missed yesterday. 1999-11-16 16:55:28 +00:00
Tom Lane e1492cc34c Modify elog() logic so that it won't try to longjmp(Warn_restart) before
Warn_restart has been set by the backend main loop.  This means that
elog(ERROR) or elog(FATAL) in the postmaster or during backend startup
now have well-defined behavior: proc_exit() rather than coredump.
In the case of elog() inside the postmaster, I think that proc_exit()
is probably not enough --- don't we want our child backends to be
forced to quit too?  But I don't understand Vadim's recent changes in
this area, so I'll leave it to him to look over and tweak if needed.
1999-11-16 06:13:36 +00:00
Bruce Momjian dc5c7713bc Commit to make clearer distinction for temp names and real names.
Thanks to Tom Lane for ideas.
1999-11-16 04:14:03 +00:00
Tom Lane f68e11f373 Implement subselects in target lists. Also, relax requirement that
subselects can only appear on the righthand side of a binary operator.
That's still true for quantified predicates like x = ANY (SELECT ...),
but a subselect that delivers a single result can now appear anywhere
in an expression.  This is implemented by changing EXPR_SUBLINK sublinks
to represent just the (SELECT ...) expression, without any 'left hand
side' or combining operator --- so they're now more like EXISTS_SUBLINK.
To handle the case of '(x, y, z) = (SELECT ...)', I added a new sublink
type MULTIEXPR_SUBLINK, which acts just like EXPR_SUBLINK used to.
But the grammar will only generate one for a multiple-left-hand-side
row expression.
1999-11-15 02:00:15 +00:00
Bruce Momjian 86ef36c907 New NameStr macro to convert Name to Str. No need for var.data anymore.
Fewer calls to nameout.

Better use of RelationGetRelationName.
1999-11-07 23:08:36 +00:00
Hiroshi Inoue 2e2189a568 Make it possible to execute crashed CREATE/DROP commands again.
Now indexes of pg_class and pg_type are unique indexes
and guarantee the uniqueness of correponding attributes.
heap_create() was changed to take another boolean parameter
which allows to postpone the creation of disk file.
The name of rd_nonameunlinked was changed to rd_unlinked.
It is used generally(not only for noname relations) now.
Requires initdb.
1999-11-04 08:01:09 +00:00
Bruce Momjian d16b706e7a Allow indexes on system catalogs for use in cache code.
Thanks to Hiroshi
1999-11-01 02:29:27 +00:00
Tom Lane 987026c931 Rule dumper failed to affix '*' to inheritable RTEs. 1999-10-31 18:57:42 +00:00
Tom Lane cf627ab41a Further performance improvements in sorting: reduce number of comparisons
during initial run formation by keeping both current run and next-run
tuples in the same heap (yup, Knuth is smarter than I am).  And, during
merge passes, make use of available sort memory to load multiple tuples
from any one input 'tape' at a time, thereby improving locality of
access to the temp file.
1999-10-30 17:27:15 +00:00
Tom Lane 51f62d505e Standardize on MAXPGPATH as the size of a file pathname buffer,
eliminating some wildly inconsistent coding in various parts of the
system.  I set MAXPGPATH = 1024 in config.h.in.  If anyone is really
convinced that there ought to be a configure-time test to set the
value, go right ahead ... but I think it's a waste of time.
1999-10-25 03:08:03 +00:00
Tom Lane ecd0bfa81a Look Ma, no MAX_PARSE_BUFFER! (At least not in the backend.
pg_dump and interfaces/odbc still need some work.)
1999-10-23 03:13:33 +00:00
Tom Lane b7d49a4209 Drive a stake through the heart of the last use of MAX_PARSE_BUFFER
in the backend.  Still a few stragglers, but we're getting closer to
being rid of query length limits...
1999-10-18 03:32:29 +00:00
Tom Lane 887afac1f5 Remove now-dead sort modules. 1999-10-17 22:19:07 +00:00
Tom Lane 26c48b5e8c Final stage of psort reconstruction work: replace psort.c with
a generalized module 'tuplesort.c' that can sort either HeapTuples or
IndexTuples, and is not tied to execution of a Sort node.  Clean up
memory leakages in sorting, and replace nbtsort.c's private implementation
of mergesorting with calls to tuplesort.c.
1999-10-17 22:15:09 +00:00
Tom Lane 957146dcec Second phase of psort reconstruction project: add bookkeeping logic to
recycle storage within sort temp file on a block-by-block basis.  This
reduces peak disk usage to essentially just the volume of data being
sorted, whereas it had been about 4x the data volume before.
1999-10-16 19:49:28 +00:00
Tom Lane db3c4c3a2d Split 'BufFile' routines out of fd.c into a new module, buffile.c. Extend
BufFile so that it handles multi-segment temporary files transparently.
This allows sorts and hashes to work with data exceeding 2Gig (or whatever
the local limit on file size is).  Change psort.c to use relative seeks
instead of absolute seeks for backwards scanning, so that it won't fail
when the data volume exceeds 2Gig.
1999-10-13 15:02:32 +00:00
Hiroshi Inoue 05d13cad28 The 1st step to implement new type of scan,TidScan.
Now WHERE restriction on ctid is allowed though it is
sequentially scanned.
1999-10-11 06:28:29 +00:00
Jan Wieck 34eb4f0a32 First real FOREIGN KEY constraint trigger functionality.
Implemented now:

    FOREIGN KEY ... REFERENCES ... MATCH FULL
	FOREIGN KEY ... MATCH FULL ... ON DELETE CASCADE

Jan
1999-10-08 12:00:08 +00:00
Bruce Momjian ae61ef34bd Cleanup -is flag to -l for SSL. Another PERL variable name fix. Clean
up debugging options for postmaster and postgres programs.  postmaster
-d is no longer optional.  Documentation updates.
1999-10-08 04:28:57 +00:00
Vadim B. Mikheev 4793740367 XLOG (also known as WAL -:)) Bootstrap/Startup/Shutdown.
First step in cleaning up backend initialization code.
Fix for FATAL: now FATAL is ERROR + exit.
1999-10-06 21:58:18 +00:00
Tom Lane 3e21ecbbe6 Make the rule deparser a little less quote-happy, so that
display of default expressions isn't quite so ugly.
1999-10-04 04:37:23 +00:00
Tom Lane eabc714a91 Reimplement parsing and storage of default expressions and constraint
expressions in CREATE TABLE.  There is no longer an emasculated expression
syntax for these things; it's full a_expr for constraints, and b_expr
for defaults (unfortunately the fact that NOT NULL is a part of the
column constraint syntax causes a shift/reduce conflict if you try a_expr.
Oh well --- at least parenthesized boolean expressions work now).  Also,
stored expression for a column default is not pre-coerced to the column
type; we rely on transformInsertStatement to do that when the default is
actually used.  This means "f1 datetime default 'now'" behaves the way
people usually expect it to.
BTW, all the support code is now there to implement ALTER TABLE ADD
CONSTRAINT and ALTER TABLE ADD COLUMN with a default value.  I didn't
actually teach ALTER TABLE to call it, but it wouldn't be much work.
1999-10-03 23:55:40 +00:00
Tom Lane 6eb8d255d2 Allow CREATE FUNCTION's WITH clause to be used for all language types,
not just C, so that ISCACHABLE attribute can be specified for user-defined
functions.  Get rid of ParamString node type, which wasn't actually being
generated by gram.y anymore, even though define.c thought that was what
it was getting.  Clean up minor bug in dfmgr.c (premature heap_close).
1999-10-02 21:33:33 +00:00
Tom Lane 1f122a7c4c Replace float.c's #ifdef finite check with a proper autoconf check, so it
works if finite() is a function.  Patch from Christof Petig.
1999-10-02 17:45:31 +00:00
Tom Lane cd243d27ce Revise rule-printing routines to use expandable StringInfo buffers, so that
they have no hardwired limit on the length of a rule's text.  Fix a couple
of minor bugs in passing --- deparsed UPDATE queries didn't have quotes
around relation name, and quotes and backslashes in constant values weren't
backslash-quoted.
1999-10-02 01:08:05 +00:00
Jan Wieck ccecf1fa46 Added utils/adt/ri_triggers with empty shells for the
FOREIGN KEY triggers.

Added pg_proc entries for all the new functions.

Jan
1999-09-30 14:54:24 +00:00
Jan Wieck daaeafd9e1 Removed (useless) pg_proc_prosrc_index
Jan
1999-09-30 10:31:47 +00:00
Jan Wieck b5c4b77283 Added nbtree operator class for NUMERIC
Jan
1999-09-29 21:13:31 +00:00
Vadim B. Mikheev 3fea625e9d Make tree compilable (+WAL). 1999-09-28 11:41:09 +00:00
Vadim B. Mikheev 539b6304b3 heap_close(rel, AccessShareLock);
^^^^^^^^^^^^^^^^^ need in
1999-09-28 11:27:13 +00:00
Bruce Momjian 9394d62c73 I have been working with user defined types and user defined c
functions.  One problem that I have encountered with the function
manager is that it does not allow the user to define type conversion
functions that convert between user types. For instance if mytype1,
mytype2, and mytype3 are three Postgresql user types, and if I wish to
define Postgresql conversion functions like

I run into problems, because the Postgresql dynamic loader would look
for a single link symbol, mytype3, for both pieces of object code.  If
I just change the name of one of the Postgresql functions (to make the
symbols distinct), the automatic type conversion that Postgresql uses,
for example, when matching operators to arguments no longer finds the
type conversion function.

The solution that I propose, and have implemented in the attatched
patch extends the CREATE FUNCTION syntax as follows. In the first case
above I use the link symbol mytype2_to_mytype3 for the link object
that implements the first conversion function, and define the
Postgresql operator with the following syntax

The patch includes changes to the parser to include the altered
syntax, changes to the ProcedureStmt node in nodes/parsenodes.h,
changes to commands/define.c to handle the extra information in the AS
clause, and changes to utils/fmgr/dfmgr.c that alter the way that the
dynamic loader figures out what link symbol to use.  I store the
string for the link symbol in the prosrc text attribute of the pg_proc
table which is currently unused in rows that reference dynamically
loaded
functions.


Bernie Frankpitt
1999-09-28 04:34:56 +00:00
Bruce Momjian d62a7ac6d3 Massimo's SET FSYNC and SHOW PG_OPTIONS changes, without SET QUERY_LIMIT. 1999-09-27 20:27:32 +00:00
Tom Lane be09bc9ff2 Modify nodeAgg.c so that no rows are returned for a GROUP BY
with no input rows, per pghackers discussions around 7/22/99.  Clean up
a bunch of ugly coding while at it; remove redundant re-lookup of
aggregate info at start of each new GROUP.  Arrange to pfree intermediate
values when they are pass-by-ref types, so that aggregates on pass-by-ref
types no longer eat memory.  This takes care of a couple of TODO items...
1999-09-26 21:21:15 +00:00
Tom Lane e812458b27 Several changes here, not very related but touching some of the same files.
* Buffer refcount cleanup (per my "progress report" to pghackers, 9/22).
* Add links to backend PROC structs to sinval's array of per-backend info,
and use these links for routines that need to check the state of all
backends (rather than the slow, complicated search of the ShmemIndex
hashtable that was used before).  Add databaseOID to PROC structs.
* Use this to implement an interlock that prevents DESTROY DATABASE of
a database containing running backends.  (It's a little tricky to prevent
a concurrently-starting backend from getting in there, since the new
backend is not able to lock anything at the time it tries to look up
its database in pg_database.  My solution is to recheck that the DB is
OK at the end of InitPostgres.  It may not be a 100% solution, but it's
a lot better than no interlock at all...)
* In ALTER TABLE RENAME, flush buffers for the relation before doing the
rename of the physical files, to ensure we don't get failures later from
mdblindwrt().
* Update TRUNCATE patch so that it actually compiles against current
sources :-(.
You should do "make clean all" after pulling these changes.
1999-09-24 00:25:33 +00:00
Bruce Momjian dabc3f31b5 Fix for netmask('x.x.x.x/0') is 255.255.255.255 instead of 0.0.0.0
This is because (-1) << 32 is -1 (Only intel arc. has been checked)

Oleg Sharoiko
1999-09-23 17:42:23 +00:00
Bruce Momjian e7cad7b0cb Add TRUNCATE command, with psql help and sgml additions. 1999-09-23 17:03:39 +00:00
Bruce Momjian ad604ac372 values.h patch from Alex Howansky 1999-09-21 20:58:25 +00:00
Tom Lane bd272cace6 Mega-commit to make heap_open/heap_openr/heap_close take an
additional argument specifying the kind of lock to acquire/release (or
'NoLock' to do no lock processing).  Ensure that all relations are locked
with some appropriate lock level before being examined --- this ensures
that relevant shared-inval messages have been processed and should prevent
problems caused by concurrent VACUUM.  Fix several bugs having to do with
mismatched increment/decrement of relation ref count and mismatched
heap_open/close (which amounts to the same thing).  A bogus ref count on
a relation doesn't matter much *unless* a SI Inval message happens to
arrive at the wrong time, which is probably why we got away with this
sloppiness for so long.  Repair missing grab of AccessExclusiveLock in
DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi.
Recommend 'make clean all' after pulling this update; I modified the
Relation struct layout slightly.
Will post further discussion to pghackers list shortly.
1999-09-18 19:08:25 +00:00
Tom Lane 4644fc8071 Eliminate query length limitation imposed by pg_client_to_server
and pg_server_to_client.  Eliminate copy.c's restriction on the length
of a single attribute.
1999-09-11 22:28:11 +00:00
Tom Lane b399805e22 Eliminate elog()'s hardwired limit on length of an error message.
This change seems necessary in conjunction with long queries, and it
cleans up some bogosity in connection with long EXPLAIN texts anyway.
Note that current libpq will accept any length error message (at least
until it runs out of memory); prior versions have a limit of 8K, but
will cleanly discard excess error text, so there shouldn't be any
big compatibility problems with old clients.
1999-09-11 19:06:42 +00:00
Tom Lane 5bc0d31ae8 Repair incorrect cleanup of heap memory allocation during
transaction abort --- before it only worked if there was exactly one level
of allocation context stacked in the blank portal.  Now it does the right
thing for any depth, including zero...
1999-09-09 16:25:35 +00:00
Tom Lane 51db6455ea Repair error noticed by Roberto Cornacchia: selectivity code
was rejecting negative attnums as bogus, which of course they are not.
Add code to get_attdisbursion to produce a useful value for OID attribute,
since VACUUM does not store stats for system attributes.
Also, repair bug that's been in eqjoinsel for a long time: it was taking
the max of the two columns' disbursions, whereas it should use the min.
1999-09-09 02:36:04 +00:00