Tom Lane [Thu, 17 Apr 2003 22:26:02 +0000 (22:26 +0000)]
First phase of FE/BE protocol modifications: new StartupPacket layout
with variable-width fields. No more truncation of long user names.
Also, libpq can now send its environment-variable-driven SET commands
as part of the startup packet, saving round trips to server.
Tom Lane [Thu, 17 Apr 2003 04:50:20 +0000 (04:50 +0000)]
Fix abstime-to-time cast function, which has had broken implementation
since 7.2, per bug #947. Turns out it had wrong volatility label, too.
Can't force initdb in 7.3 branch, but fix anyway for future installs.
Barry Lind [Thu, 17 Apr 2003 04:37:07 +0000 (04:37 +0000)]
Applied patches from Kris Jurka fixing a string tokenizing problem and
fixing an order by problem for index metadata results.
Also includes removing some unused code as well as a fix to the toString
method on statement.
Tom Lane [Wed, 16 Apr 2003 20:53:38 +0000 (20:53 +0000)]
Various clarifications; add a clear DRAFT marker; minor adjustments in
some message types. In particular add text/binary flag to StartCopyIn
and StartCopyOut, so that client library can know what is expected or
forthcoming.
Tom Lane [Tue, 15 Apr 2003 05:18:12 +0000 (05:18 +0000)]
eqjoinsel's logic for case where MCV lists are not present should
account for NULLs; in hindsight this is obvious since the code for
the MCV-lists case would reduce to this when there are zero entries
in both lists. Per example from Alec Mitchell.
Tom Lane [Mon, 14 Apr 2003 17:31:33 +0000 (17:31 +0000)]
Reorganize clog's error reporting so that PANIC on clog I/O error can
be reduced to a plain ERROR. Should make it at least a little less
painful to deal with data-corruption problems.
Tom Lane [Thu, 10 Apr 2003 02:47:46 +0000 (02:47 +0000)]
Remove premature attempt to constant-fold type coercion expressions.
While usually safe, this fails if the coercion function needs the
query snapshot to be set already. Per example from Nigel Andrews.
Peter Eisentraut [Thu, 10 Apr 2003 01:22:45 +0000 (01:22 +0000)]
In an effort to reduce the total number of chapters, combine the small
chapters on extending types, operators, and aggregates into the extending
functions chapter. Move the information on how to call table functions
into the queries chapter. Remove some outdated information that is
already present in a better form in other parts of the documentation.
Tom Lane [Tue, 8 Apr 2003 23:20:04 +0000 (23:20 +0000)]
First phase of work on array improvements. ARRAY[x,y,z] constructor
expressions, ARRAY(sub-SELECT) expressions, some array functions.
Polymorphic functions using ANYARRAY/ANYELEMENT argument and return
types. Some regression tests in place, documentation is lacking.
Joe Conway, with some kibitzing from Tom Lane.
Jan Wieck [Mon, 7 Apr 2003 20:30:38 +0000 (20:30 +0000)]
Avoid primary key lookup (and lock) if foreign key does not change
on UPDATE.
This get's rid of the long standing annoyance that updating a row
that has foreign keys locks all the referenced rows even if the
foreign key values do not change.
The trick is to actually do a check identical to NO ACTION after an
eventually done UPDATE in the SET DEFAULT case. Since a SET DEFAULT
operation should have moved referencing rows to a new "home", a following
NO ACTION check can only fail if the column defaults of the referencing
table resulted in the key we actually deleted. Thanks to Stephan.
Tom Lane [Fri, 4 Apr 2003 04:50:44 +0000 (04:50 +0000)]
Avoid repeated computation of the constants date2j(1970, 1, 1) and
date2j(2000, 1, 1). Should make for some marginal speed improvement
in date/time operations.
Tom Lane [Fri, 4 Apr 2003 03:03:54 +0000 (03:03 +0000)]
Code review for pg_stat_get_backend_activity_start patch --- fix
return type, make protection condition agree with recent change to
pg_stat_get_backend_activity, clean up documentation.
Tom Lane [Thu, 3 Apr 2003 23:32:47 +0000 (23:32 +0000)]
Remove zero_damaged_pages from postgresql.conf.sample; the only way to
find out about it is to read the documentation that tells you how
dangerous it is. Add default_transaction_read_only to documentation;
seems to have been overlooked in patch that added read-only transactions.
Clean up check_guc comparison script, which has been suffering bit rot.
Tom Lane [Thu, 3 Apr 2003 22:35:48 +0000 (22:35 +0000)]
Prevent EXPLAIN (without ANALYZE) SELECT ... INTO from creating an INTO
table. Needed due to recent change that makes us call ExecutorStart
even when not planning to carry out the query.
Bruce Momjian [Mon, 31 Mar 2003 20:47:51 +0000 (20:47 +0000)]
The following patch cleans up the deferred trigger mechanism. There is
an unneeded memory context and some variables that are not used anymore.
It's pretty trivial and the regression tests pass fine. There's no
change in functionality, only deletion of unused code. I left an empty
function because maybe I'll need it for nested transactions.
Tom Lane [Mon, 31 Mar 2003 20:32:29 +0000 (20:32 +0000)]
TestConfiguration returns int, not bool. This mistake is relatively
harmless on signed-char machines but would lead to core dump in the
deadlock detection code if char is unsigned. Amazingly, this bug has
been here since 7.1 and yet wasn't reported till now. Thanks to Robert
Bruccoleri for providing the opportunity to track it down.
Bruce Momjian [Sat, 29 Mar 2003 03:56:44 +0000 (03:56 +0000)]
[ Backpatch to 7.3.X.]
typing error in src/backend/libpq/be-secure.c ???
Long Description
In src/backend/libpq/be-secure.c: secure_write
on SSL_ERROR_WANT_WRITE call secure_read instead
secure_write again. May be is this a typing error?
Sergey N. Yatskevich (syatskevich@n21lab.gosniias.msk.ru)
Tom Lane [Fri, 28 Mar 2003 20:17:13 +0000 (20:17 +0000)]
Add code to apply some simple sanity checks to the header fields of a
page when it's read in, per pghackers discussion around 17-Feb. Add a
GUC variable zero_damaged_pages that causes the response to be a WARNING
followed by zeroing the page, rather than the normal ERROR; this is per
Hiroshi's suggestion that there needs to be a way to get at the data
in the rest of the table.
Bruce Momjian [Thu, 27 Mar 2003 16:58:21 +0000 (16:58 +0000)]
It may not be obvious to you, but the plpython regression tests
include output that vary depending on the python build one is
running. Basically, the order of keys in a dictionary is
non-deterministic, and that part of the test fails for me regularly.
I rewrote the test to work around this problem, and include a patch
file with that change and the change to the expected otuput as well.
Bruce Momjian [Thu, 27 Mar 2003 16:57:39 +0000 (16:57 +0000)]
New \d format:
Example:
test=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
a | integer | not null
Indexes:
"test_pkey" PRIMARY KEY btree (a)
Check Constraints:
"$2" CHECK (a > 1)
Foreign Key Constraints:
"$1" FOREIGN KEY (a) REFERENCES parent(b)
Rules:
myrule AS ON INSERT TO test DO INSTEAD NOTHING
Triggers:
"asdf asdf" AFTER INSERT OR DELETE ON test FOR EACH STATEMENT EXECUTE
PROCEDURE update_pg_pwd_and_pg_group(),
mytrigger AFTER INSERT OR DELETE ON test FOR EACH ROW EXECUTE PROCEDURE
update_pg_pwd_and_pg_group()
I have minimised the double quoting of identifiers as much as I could
easily, and I will submit another patch when I have time to work on it that
will use a 'fmtId' function to determine it exactly.
I think it's a significant improvement in legibility...
Obviously the table example above is slightly degenerate in that not many
tables in production have heaps of (non-constraint) triggers and rules.
Bruce Momjian [Thu, 27 Mar 2003 16:51:29 +0000 (16:51 +0000)]
This patch implements holdable cursors, following the proposal
(materialization into a tuple store) discussed on pgsql-hackers earlier.
I've updated the documentation and the regression tests.
Notes on the implementation:
- I needed to change the tuple store API slightly -- it assumes that it
won't be used to hold data across transaction boundaries, so the temp
files that it uses for on-disk storage are automatically reclaimed at
end-of-transaction. I added a flag to tuplestore_begin_heap() to control
this behavior. Is changing the tuple store API in this fashion OK?
- in order to store executor results in a tuple store, I added a new
CommandDest. This works well for the most part, with one exception: the
current DestFunction API doesn't provide enough information to allow the
Executor to store results into an arbitrary tuple store (where the
particular tuple store to use is chosen by the call site of
ExecutorRun). To workaround this, I've temporarily hacked up a solution
that works, but is not ideal: since the receiveTuple DestFunction is
passed the portal name, we can use that to lookup the Portal data
structure for the cursor and then use that to get at the tuple store the
Portal is using. This unnecessarily ties the Portal code with the
tupleReceiver code, but it works...
The proper fix for this is probably to change the DestFunction API --
Tom suggested passing the full QueryDesc to the receiveTuple function.
In that case, callers of ExecutorRun could "subclass" QueryDesc to add
any additional fields that their particular CommandDest needed to get
access to. This approach would work, but I'd like to think about it for
a little bit longer before deciding which route to go. In the mean time,
the code works fine, so I don't think a fix is urgent.
- (semi-related) I added a NO SCROLL keyword to DECLARE CURSOR, and
adjusted the behavior of SCROLL in accordance with the discussion on
-hackers.
- (unrelated) Cleaned up some SGML markup in sql.sgml, copy.sgml
Bruce Momjian [Thu, 27 Mar 2003 16:45:51 +0000 (16:45 +0000)]
* Make pg_get_triggerdef documentation consistent with other pg_get_
functions
* Document pg_conversion_is_visible() which was created in one of my
previous patches and didn't get documented for some reason
Bruce Momjian [Thu, 27 Mar 2003 16:45:01 +0000 (16:45 +0000)]
Attached are two patches for psql's tab-completion.c.
The first cleans up a couple of minor errors and ommissions
and adds tab completion support to more slash commands, e.g.
\dv.
The second is an attempt to add tab completion for schemas
and fully qualified relation names (e.g. public.mytable ).
I think this covers the TODO-item:
"Allow psql to do table completion for SELECT * FROM schema_part and table
completion for SELECT * FROM schema_name."
This happens via union selects querying:
- relation_name in current search path;
- schema_name;
- schema.relation_name
matching the current input string.
E.g:
SELECT p[TAB]
will produce a list of all appropriate relation names in the current search
path which begin with 'p', and also all schema names which begin with 'p';
\d pub[TAB]
will produce any relation names in the current search path and also
any schema names beginning with 'pub';
\d public.[TAB]
will produce a list of all relations in the schema 'public';
\d public.my[TAB]
produces all relation names beginning with 'my' in schema 'public'.
It seems to work for me; comments, suggestions, particularly regarding
the coding and queries, are very welcome.
Note that tables, indexes, views and sequences relations in the
'pg_catalog' namespace are excluded even though they are in
the current search path. I found not doing this produced annoying behaviour
when expanding names beginning with 'p'. People who work with system
tables a lot may not like this though; I can look for another solution
if necessary.