Tom Lane [Sun, 19 Mar 2000 07:13:58 +0000 (07:13 +0000)]
transformExpr() did the Wrong Thing if applied to a SubLink node that
had already been transformed. This led to failure in examples like
UPDATE table SET fld = (SELECT ...). Repair this, and revise the
comments to explain that transformExpr has to be robust against this
condition. Someday we might want to fix the callers so that
transformExpr is never invoked on its own output, but that someday
is not today.
Bruce Momjian [Sun, 19 Mar 2000 02:19:43 +0000 (02:19 +0000)]
it seems in the beta2 release DBUSERID in pg_dumpall is the _name_ of the
user, so it doesn't need to be translated from the number to the name.
also ``create database ...'' does not take numbers for the encoding, so
the ENCODING variable does not need to be translated to a number, but left
as the text representation. a patch is supplied to make the changes i
have found to work. i was successful dumping and reloading my database
after these changes.
-
Tom Lane [Sun, 19 Mar 2000 01:12:18 +0000 (01:12 +0000)]
Fix incorrect implementation of log(x) for numeric, as well as
incorrect descriptions of a couple of log-related functions.
I will not force an initdb for this, but log() on a numeric won't
work until you do one...
Tom Lane [Sun, 19 Mar 2000 00:19:39 +0000 (00:19 +0000)]
Another go-round with resolution of ambiguous functions and operators.
In function parsing, try for an actual function of the given name and
input types before trying to interpret the function call as a type
coercion request, rather than after. Before, a function that had the
same name as a type and operated on a binary-compatible type wouldn't
get invoked. Also, cross-pollinate between func_select_candidates and
oper_select_candidates to ensure that they use as nearly the same
resolution rules as possible. A few other minor code cleanups too.
Tom Lane [Sat, 18 Mar 2000 19:53:54 +0000 (19:53 +0000)]
Improve error message wording in unary_op_error() --- suggest that
problem could be lack of parentheses. This addresses cases like
X UserOp UserOp Y, which will be parsed as (X UserOp) UserOp Y,
whereas what likely was wanted was X UserOp (UserOp Y).
Tom Lane [Sat, 18 Mar 2000 18:03:12 +0000 (18:03 +0000)]
Modify lexing of multi-char operators per pghackers discussion around
16-Mar-00: trailing + or - is not part of the operator unless the operator
also contains characters not present in SQL92-defined operators. This
solves the 'X=-Y' problem without unduly constraining users' choice of
operator names --- in particular, no existing Postgres operator names
become invalid.
Also, remove processing of // comments, as agreed in the same thread.
Tom Lane [Sat, 18 Mar 2000 04:32:35 +0000 (04:32 +0000)]
Just noticed that the grammar actually has no provision for '+' as a
prefix operator :-(. Bad enough that we have no implementation of
unary plus, but at least with this fix the grammar will take it.
Tom Lane [Fri, 17 Mar 2000 02:36:41 +0000 (02:36 +0000)]
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...
Bruce Momjian [Thu, 16 Mar 2000 15:34:36 +0000 (15:34 +0000)]
libpq++ Makefile uses -DDEBUG to turn on debugging trace to
/tmp/trace.out.
However, elog.h uses DEBUG as a log-level flag. As a result, tracing is
turned on even if the libpq++.so is built with DEBUG commented out in
the Makefile.
This patch changes libpq++ to use DEBUGFILE instead (which is not
defined anywhere else).
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.
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.
Update geometry.out with results from Linux RH 5.2 system
(for last decimal place).
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.
Fix single-space typo in printed message in regress.sh.
Tom Lane [Thu, 16 Mar 2000 06:35:07 +0000 (06:35 +0000)]
Turns out that Mazurkiewicz's gripe about 'function inheritance' is
actually a type-coercion problem. If you have a function defined on
class A, and class B inherits from A, then the function ought to work
on class B as well --- but coerce_type didn't know that. Now it does.
Tom Lane [Thu, 16 Mar 2000 03:23:18 +0000 (03:23 +0000)]
Fix some (more) problems with subselects in rules. Rewriter failed to
mark query as having subselects if a subselect was added from a rule
WHERE condition (as opposed to a rule action). Also, fix adjustment
of varlevelsup so that it actually has some prospect of working when
inserting an expression containing a subselect into a subquery.
Tom Lane [Wed, 15 Mar 2000 23:31:19 +0000 (23:31 +0000)]
Tweak GROUP BY so that it will still accept result-column names, but only
after trying to resolve the item as an input-column name. This allows us
to be compliant with the SQL92 spec for queries that fall within the spec,
while still accepting the same out-of-spec queries as 6.5 did. You'll only
lose if there is an output column name that is the same as an input
column name, but doesn't refer to the same value. 7.0 will interpret
such a GROUP BY spec differently than 6.5 did. No way around that, because
6.5 was clearly not spec compliant.
Tom Lane [Wed, 15 Mar 2000 06:50:51 +0000 (06:50 +0000)]
Remove gratuitous and incorrect begin/commit transaction calls in
CREATE DB/DROP DB. If you didn't think they were wrong, try what
happens when you compile with -DCLOBBER_FREED_MEMORY --- database
name displayed in error messages is trashed, because transaction
abort freed it. Also, remove trailing periods in error messages,
per our prevailing style.
Tom Lane [Wed, 15 Mar 2000 05:31:55 +0000 (05:31 +0000)]
Add 'datetime' -> 'timestamp' conversion to xlateSqlFunc() to ease
the pain of updating apps to 7.0. Should we also translate some of
the 'datetime_foo' functions that exist in 6.* ?
Tom Lane [Tue, 14 Mar 2000 23:52:01 +0000 (23:52 +0000)]
Cache fmgr lookup data for index's getnext() function in IndexScanDesc,
so that the fmgr lookup only has to happen once per index scan and not
once per tuple. Seems to save 5% or so of CPU time for an indexscan.
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.
Tom Lane [Tue, 14 Mar 2000 22:46:27 +0000 (22:46 +0000)]
Marginal performance improvement in LockBuffer --- calculate address
of BufferLocks[] entry just once. Seems to save 10% or so of the
routine's runtime, which'd not be worth worrying about if it weren't
such a hotspot.
Tatsuo Ishii [Tue, 14 Mar 2000 08:34:47 +0000 (08:34 +0000)]
Detect postmaster being ready by calling psql -l rathern than
checking postmaster.pid. It's not enough to check the existence
of postmaster.pid since DB recovery might be running.
Tom Lane [Tue, 14 Mar 2000 02:23:15 +0000 (02:23 +0000)]
Fix some bogosities in the code that deals with estimating the fraction
of tuples we are going to retrieve from a sub-SELECT. Must have been
half asleep when I did this code the first time :-(
Tom Lane [Mon, 13 Mar 2000 02:31:13 +0000 (02:31 +0000)]
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.
Tom Lane [Mon, 13 Mar 2000 01:54:07 +0000 (01:54 +0000)]
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.
Tom Lane [Mon, 13 Mar 2000 01:52:06 +0000 (01:52 +0000)]
Performance improvement for lexing long strings: increase flex's
YY_READ_BUF_SIZE, which turns out to have nothing to do with buffer size.
It's just a totally arbitrary upper limit on how much data myinput() is
asked for at one time.
Tom Lane [Sun, 12 Mar 2000 19:32:06 +0000 (19:32 +0000)]
Fix performance bug in constant-expression simplifier. After finding
that the inputs to a given operator can be recursively simplified to
constants, it was evaluating the operator using the op's *original*
(unsimplified) arg list, so that any subexpressions had to be evaluated
again. A constant subexpression at depth N got evaluated N times.
Probably not very important in practical situations, but it made us look
real slow in MySQL's 'crashme' test...
Tom Lane [Sun, 12 Mar 2000 18:57:05 +0000 (18:57 +0000)]
Fix performance problem in fireRIRonSubselect: with nested subqueries,
fireRIRonSubselect was invoked twice at each subselect, leading to an
exponential amount of wasted effort.
Tom Lane [Sun, 12 Mar 2000 00:39:52 +0000 (00:39 +0000)]
Clean up grammar's handling of NULL in expressions: a_expr_or_null is
gone, replaced by plain a_expr. The few places where we needed to
distinguish NULL from a_expr are now handled by tests inside the actions
rather than by separate productions. This allows us to accept queries
like 'SELECT 1 + NULL' without requiring parentheses around the NULL.
Tom Lane [Sat, 11 Mar 2000 23:53:41 +0000 (23:53 +0000)]
Further tweaking of logic that decides when to materialize an uncorrelated
subplan: do it if subplan has subplans itself, and always do it if the
subplan is an indexscan. (I originally set it to materialize an indexscan
only if the indexqual is fairly selective, but I dunno what I was
thinking ... an unselective indexscan is still expensive ...)
Tom Lane [Sat, 11 Mar 2000 23:17:47 +0000 (23:17 +0000)]
Further fixes for bogus list-slinging, scribbling on input, etc in type
coercion code. I'm beginning to wonder why we have separate candidate
selection routines for functions, operators, and aggregates --- shouldn't
this code all be unified? But meanwhile,
SELECT 'a' LIKE 'a';
finally works; the code for dealing with unknown input types for operators
was pretty busted.
Tom Lane [Sat, 11 Mar 2000 06:19:00 +0000 (06:19 +0000)]
exec_simple_check_plan() must not allow a plan having initPlans or
subPlans to be considered 'simple'. This fixes reported problem with
'return exists (select 1 from foo);' in plpgsql function.
Tom Lane [Sat, 11 Mar 2000 05:14:06 +0000 (05:14 +0000)]
Finish cleaning up backend's handling of /* ... */ and -- comments,
per pghackers discussion around 20-Feb. Also add specific error messages
for unterminated comments and unterminated quoted strings. These things
are nonissues for input coming from psql, but they do matter for input
coming from other front ends.
Tom Lane [Sat, 11 Mar 2000 03:08:37 +0000 (03:08 +0000)]
Change PQconndefaults() to return a malloc'd array, instead of a static
array. This allows processing of conninfo strings to be made thread-safe,
at the cost of a small memory leak in applications that use
PQconndefaults() and are not updated to free the returned array via
the new PQconninfoFree() function. But PQconndefaults() is probably not
used very much, so this seems like a good compromise.
Tom Lane [Thu, 9 Mar 2000 05:15:33 +0000 (05:15 +0000)]
Redo permissions-checking code so that it does the right thing at APPEND
nodes. The former version failed to check permissions of relations that
were referenced in second and later clauses of UNIONs, and it did not
check permissions of tables referenced via inheritance.
Bruce Momjian [Wed, 8 Mar 2000 01:58:46 +0000 (01:58 +0000)]
I've made a diff against the 7.0beta1 tree that accomplishes several things:
1) adds NetBSD shared lib support on both ELF and a.out platforms
2) replaces "-L$(LIBPQDIR) -lpq" with "$(LIBPQ)" defined in
Makefile.global. This makes it much easier to build stuff in
the source tree after you've already installed the libraries.
3) adds TEMPLATEDIR in Makefile.global that indicates where the
database templates are stored. This separates the template files
from real libraries that are installed in $(LIBDIR).
4) changes include order of <readline/readline.h> and <readline.h>.
The latest GNU readline installs its headers under a readline
subdirectory.
In addition to applying the patch below the following files need to be copied:
Bruce Momjian [Wed, 8 Mar 2000 01:46:47 +0000 (01:46 +0000)]
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.
Bruce Momjian [Wed, 8 Mar 2000 01:38:59 +0000 (01:38 +0000)]
Hi Peter,
I try change prompt in the psql, but it is set '.' (as '%m') for
non-TCP/IP
connection. This small patch try use uname() information for non-TCP/IP
instead '.'.
Bruce Momjian [Wed, 8 Mar 2000 01:34:41 +0000 (01:34 +0000)]
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.
Bruce Momjian [Tue, 7 Mar 2000 23:49:31 +0000 (23:49 +0000)]
I've recently written to pgsql-ports about a problem with PG7.0 on NT
(Subj: [PORTS] initdb problem on NT with 7.0). Since nobody helped me,
I had to find out the reson. The difference between NT and Linux (for
instance) is that "open( path, O_RDWR );" opens a file in text mode. So
sometime less block can be read than required.
I suggest a following patch. BTW the situation appeared before, see
hba.c, pqcomm.c and others.
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...