Tom Lane [Fri, 4 Jul 2003 02:51:34 +0000 (02:51 +0000)]
Some early work on error message editing. Operator-not-found and
function-not-found messages now distinguish the cases no-match and
ambiguous-match, and they follow the style guidelines too.
Tom Lane [Thu, 3 Jul 2003 19:41:47 +0000 (19:41 +0000)]
Fix bug I introduced in recent rewrite of NUMERIC code: numeric to
integer conversions gave the wrong answer for values with stripped
trailing zeroes, such as 10000000.
Tom Lane [Thu, 3 Jul 2003 19:07:54 +0000 (19:07 +0000)]
Do honest transformation and preprocessing of LIMIT/OFFSET clauses,
instead of the former kluge whereby gram.y emitted already-transformed
expressions. This is needed so that Params appearing in these clauses
actually work correctly. I suppose some might claim that the side effect
of 'SELECT ... LIMIT 2+2' working is a new feature, but I say this is
a bug fix.
Tom Lane [Tue, 1 Jul 2003 19:10:53 +0000 (19:10 +0000)]
Aggregates can be polymorphic, using polymorphic implementation functions.
It also works to create a non-polymorphic aggregate from polymorphic
functions, should you want to do that. Regression test added, docs still
lacking. By Joe Conway, with some kibitzing from Tom Lane.
Tom Lane [Tue, 1 Jul 2003 19:07:02 +0000 (19:07 +0000)]
Dept. of second thoughts: supporting inlining of polymorphic SQL functions
takes only a few more lines of code than preventing it, so might as well
support it.
Michael Meskes [Tue, 1 Jul 2003 12:40:52 +0000 (12:40 +0000)]
Use ISO dates in pgtypeslib by default.
Applied patch by Philip Yarra to fix some thread issues.
Added a new data type "decimal" which is mostly the same as our
"numeric" but uses a fixed length array to store the digits. This is
for compatibility with Informix and maybe others.
Tom Lane [Tue, 1 Jul 2003 01:28:32 +0000 (01:28 +0000)]
Department of second thoughts: even if we can't run the full parser on
a SQL function with polymorphic inputs, we can at least run the raw
parser to catch silly syntactic errors.
Tom Lane [Tue, 1 Jul 2003 00:04:39 +0000 (00:04 +0000)]
SQL functions can have arguments and results declared ANYARRAY or
ANYELEMENT. The effect is to postpone typechecking of the function
body until runtime. Documentation is still lacking.
Original patch by Joe Conway, modified to postpone type checking
by Tom Lane.
Tom Lane [Mon, 30 Jun 2003 16:47:02 +0000 (16:47 +0000)]
Add GUC option log_error_verbosity to control which fields of error
reports get put into the postmaster log. Options are TERSE, DEFAULT,
VERBOSE, with the same behavior as implemented on the client side in
libpq.
Barry Lind [Mon, 30 Jun 2003 16:38:30 +0000 (16:38 +0000)]
Patches applied:
1) Patch from Kris Jurka to fix IPv6 parsing of the jdbc URL
2) Patch from Kris Jurka to fix an ArrayIndexOutOfBounds error
when calling moveToCurrentRow while currentRow is "beforeFirst"
3) Patch from Kim Ho to fix add some bounds checking in setMaxRows(),
setQueryTimeout(), setFetchSize()
Tom Lane [Sun, 29 Jun 2003 23:05:05 +0000 (23:05 +0000)]
Restructure building of join relation targetlists so that a join plan
node emits only those vars that are actually needed above it in the
plan tree. (There were comments in the code suggesting that this was
done at some point in the dim past, but for a long time we have just
made join nodes emit everything that either input emitted.) Aside from
being marginally more efficient, this fixes the problem noted by Peter
Eisentraut where a join above an IN-implemented-as-join might fail,
because the subplan targetlist constructed in the latter case didn't
meet the expectation of including everything.
Along the way, fix some places that were O(N^2) in the targetlist
length. This is not all the trouble spots for wide queries by any
means, but it's a step forward.
Michael Meskes [Sun, 29 Jun 2003 16:52:58 +0000 (16:52 +0000)]
- Made sure Informix style decimal vars are initialized. They use a
fixed amount of digits and not an allocated one. So we have to work
around. PostgreSQL numeric type remains the same.
- In INFORMIX_SE mode with autcommit set, make all cursors be "with
hold". Is this really they way SE behaves?
Tom Lane [Sun, 29 Jun 2003 00:33:44 +0000 (00:33 +0000)]
Support expressions of the form 'scalar op ANY (array)' and
'scalar op ALL (array)', where the operator is applied between the
lefthand scalar and each element of the array. The operator must
yield boolean; the result of the construct is the OR or AND of the
per-element results, respectively.
Original coding by Joe Conway, after an idea of Peter's. Rewritten
by Tom to keep the implementation strictly separate from subqueries.
Tom Lane [Sat, 28 Jun 2003 00:12:40 +0000 (00:12 +0000)]
Update psql for some features of new FE/BE protocol. There is a
client-side AUTOCOMMIT mode now: '\set AUTOCOMMIT off' supports
SQL-spec commit behavior. Get rid of LO_TRANSACTION hack --- the
LO operations just work now, using libpq's ability to track the
transaction status. Add a VERBOSE variable to control verboseness
of error message display, and add a %T prompt-string code to show
current transaction-block status. Superuser state display in the
prompt string correctly follows SET SESSION AUTHORIZATION commands.
Control-C works to get out of COPY IN state.
Tom Lane [Fri, 27 Jun 2003 00:33:26 +0000 (00:33 +0000)]
Create real array comparison functions (that use the element datatype's
comparison functions), replacing the highly bogus bitwise array_eq. Create
a btree index opclass for ANYARRAY --- it is now possible to create indexes
on array columns.
Arrange to cache the results of catalog lookups across multiple array
operations, instead of repeating the lookups on every call.
Add string_to_array and array_to_string functions.
Remove singleton_array, array_accum, array_assign, and array_subscript
functions, since these were for proof-of-concept and not intended to become
supported functions.
Minor adjustments to behavior in some corner cases with empty or
zero-dimensional arrays.
Joe Conway (with some editorializing by Tom Lane).
Tom Lane [Wed, 25 Jun 2003 21:14:15 +0000 (21:14 +0000)]
In ISO datestyle, never emit just HH:MM, always emit HH:MM:SS or
HH:MM:SS.SSS... when there is a nonzero part-of-a-day field in an
interval value. The seconds part used to be suppressed if zero,
but there's no equivalent behavior for timestamp, and since we're
modeling this format on timestamp it's probably wrong. Per complaint
and patch from Larry Rosenman.
Tom Lane [Wed, 25 Jun 2003 20:07:39 +0000 (20:07 +0000)]
Don't generate 'zero' typeids in the output from gen_cross_product.
This is no longer necessary or appropriate since we don't use zero typeid
as a wildcard anymore, and it fixes a nasty performance problem with
functions with many parameters. Per recent example from Reuven Lerner.
Bruce Momjian [Wed, 25 Jun 2003 04:08:19 +0000 (04:08 +0000)]
If they're not, the below causes problems, as the foreign key is added
after the CHECK. Cluster depends on the index name, so I thought it
wise to ensure all names are available, rather than leaving off the
CONSTRAINT "$n" portion for internally named constraints.
Bruce Momjian [Wed, 25 Jun 2003 01:19:47 +0000 (01:19 +0000)]
> This change (I'm sure this will wrap poorly -- sorry):
> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/libpq/pqcomm.h.diff?r1=1.85&r2=1.86
>
> modified SockAddr, but no corresponding change was made here
> (fe-auth.c:612):
>
> case AUTH_REQ_KRB5:
> #ifdef KRB5
> if (pg_krb5_sendauth(PQerrormsg, conn->sock, &conn->laddr.in,
> &conn->raddr.in,
> hostname) != STATUS_OK)
>
> It's not obvious to me what the change ought to be though.
This patch should hopefully fix both kerberos 4 and 5.
Bruce Momjian [Wed, 25 Jun 2003 01:18:58 +0000 (01:18 +0000)]
> I've worked with the Pl/Python code in the past and will see about removing
> rexec and making it an untrusted language. Last time I looked, it didn't
> look particularly difficult. I've set aside some time next week, so stay
> tuned.
Attached is a patch that removes all of the RExec code from plpython from
the current PostgreSQL CVS. In addition, plpython needs to be changed to an
untrusted language in createlang. Please let me know if there are any
problems.
Bruce Momjian [Wed, 25 Jun 2003 01:17:44 +0000 (01:17 +0000)]
Attached is a patch that provides *VERY* limited support for multiple
slave
servers. I haven't tested it very well, so use at your own risk (and I
recommend against using it in production).
Basically, I have a central database server that has 4 summary tables
inside
it replicated to a remote slave (these database tables are for my mail
server
authentication, so these are replicated to another server tuned for many
connections, and so I don't have postgres connections opened straight to
my
back-end database server).
Unfortunately, I also wanted to implement a replication database server
for
hot-backups. I realized, too late, that the replication process is
pretty
greedy and will try to replicate all tables marked as a
"MasterAddTable".
To make a long story, I made a patch to RServ.pm and Replicate that
allows you
to specify, on the command line, a list of tables that you want to
replicate...it'll ignore all others.
I haven't finished, since this has to be integrated with CleanLog for
instance, but this should (and does) suffice for the moment.
I have yet to test it with two slaves, but at least my mail server
replication
database now works (it was failing every time it tried to replicate, for
a
variety of reasons).
Anyone have any suggestions on how to improve on this? (or, if someone
more
familiar with this code wants to take the ball and run with it, you're
welcome to).
Bruce Momjian [Wed, 25 Jun 2003 01:11:09 +0000 (01:11 +0000)]
- Corrections for tables, columns with uppercase characters
- Don't attempt to convert partial or expressional unique indexes
- Don't attempt to convert unique indexes based on a non-default
opclasses
- Untested prevention of conversion of non-btree indexes unique
indexes. Untested as postgresql doesn't allow hash, gist, or rtree
based indexes to be unique.
rbt=# create unique index t on a using hash (col);
ERROR: DefineIndex: access method "hash" does not support UNIQUE
indexes
rbt=# create unique index t on a using gist (col);
ERROR: DefineIndex: access method "gist" does not support UNIQUE
indexes
rbt=# select version();
version
------------------------------------------------------------------------
PostgreSQL 7.4devel on i386-unknown-freebsd4.8, compiled by GCC 2.95.4
Bruce Momjian [Wed, 25 Jun 2003 01:09:24 +0000 (01:09 +0000)]
This is a bug in python interface module,
postgresql-7.3.3/src/interfaces/python/pg.py.
_quote() function fails due to integer overflow if input d is larger
than max integer.
In the case where the column type is "BIGINT", the input d may very well
be larger than max integer while its type, t, is labeled 'int'.
The conversion on line 19, return "%d" % int(d), will fail due to
"OverflowError: long int too large to convert to int".
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
[1] create a table with a column type 'BIGINT'.
[2] use pg.DB.insert() to insert a value that is larger than max integer
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
Just changing the conversion at line 19 of pg.py to long(d) instead of
int(d) should fix it. The following is a patch:
Bruce Momjian [Wed, 25 Jun 2003 01:08:13 +0000 (01:08 +0000)]
>> If a transaction marks a tuple for update and later commits without
>> actually having updated the tuple, [...] can we simply
>> set the HEAP_XMAX_INVALID hint bit of the tuple?
>
>AFAICS this is a reasonable thing to do.
Thanks for the confirmation. Here's a patch which also contains some
more noncritical changes to tqual.c:
. make code more readable by introducing local variables for xvac
. no longer two separate branches for aborted and crashed.
The actions were the same in all cases.
Bruce Momjian [Tue, 24 Jun 2003 23:29:25 +0000 (23:29 +0000)]
Most of the synopsis areas for DROP commands use "name" as the
identifier, while some areas do not.
The attached converts be below to "name":
conversion_name
index_name
The below have an existing, initdb supplied, entity named "name". As
such, it could be confusing for the reader to see that identifier used
in the example.