Commit Graph

20478 Commits

Author SHA1 Message Date
Tom Lane 638feae2c9 exec_eval_datum leaks memory when dealing with ROW or REC values.
It never leaked memory before PG 8.0, so none of the callers are
expecting this.  Cleanest fix seems to be to make it allocate the needed
memory in estate->eval_econtext, where it will be cleaned up by
the next exec_eval_cleanup.  Per report from Bill Rugolsky.
2005-06-20 22:51:29 +00:00
Tom Lane 59ee9448a8 Remove read_file/write_file tests. These were originally intended to
*fail*, to test that plpython didn't allow untrusted operations.
When we changed plpython to plpythonu because python didn't actually have
a secure sandbox mode, someone (probably me :-() misinterpreted the tests
as checking whether Python's file I/O works.  Which is a stupid thing for
us to be testing.  Remove it so we don't clutter the filesystem with
random temporary files.
2005-06-20 21:14:01 +00:00
Tom Lane 9d7c005243 plpgsql's exec_assign_value() freed the old value of a variable before
copying/converting the new value, which meant that it failed badly on
"var := var" if var is of pass-by-reference type.  Fix this and a similar
hazard in exec_move_row(); not sure that the latter can manifest before
8.0, but patch it all the way back anyway.  Per report from Dave Chapeskie.
2005-06-20 20:44:44 +00:00
Tom Lane b95ae32b41 Avoid WAL-logging individual tuple insertions during CREATE TABLE AS
(a/k/a SELECT INTO).  Instead, flush and fsync the whole relation before
committing.  We do still need the WAL log when PITR is active, however.
Simon Riggs and Tom Lane.
2005-06-20 18:37:02 +00:00
Teodor Sigaev 1bfdd1a893 fix founded hole in recovery after crash, add vacuum_delay_point() 2005-06-20 15:22:38 +00:00
Tom Lane 3f6a094be1 Remove statement that GiST indexes aren't WAL-logged. 2005-06-20 14:53:32 +00:00
Tom Lane f0e7f9e30b Update text that stated GiST indexes aren't WAL-logged. 2005-06-20 13:52:17 +00:00
Teodor Sigaev d544ec8bbd 1. full functional WAL for GiST
2. improve vacuum for gist
   - use FSM
   - full vacuum:
      - reforms parent tuple if it's needed
        ( tuples was deleted on child page or parent tuple remains invalid
          after crash recovery )
      - truncate index file if possible
3. fixes bugs and mistakes
2005-06-20 10:29:37 +00:00
Neil Conway 0b62bbe086 Cosmetic improvements to the timezone code: remove the use of the
'register' qualifier, make some function declarations more consistent,
and so on.
2005-06-20 08:00:51 +00:00
Tom Lane ec490f5159 Change shell syntax that seems not to work right on FreeBSD 6-CURRENT
buildfarm machines.
2005-06-20 02:26:50 +00:00
Tom Lane d38d06374d Add lock file contents printout to "can't happen" case to help
investigate buildfarm failures.
2005-06-20 02:17:30 +00:00
Neil Conway 9de97c5531 Trivial code clarity improvement to UpdateStats(); no functional change. 2005-06-20 02:07:47 +00:00
Tom Lane 368739dca8 Fix bogus assumption that sizeof() produces an int-sized result. 2005-06-20 00:32:22 +00:00
Neil Conway 577247b023 Minor documentation update for RAISE expression patch. 2005-06-19 23:39:05 +00:00
Tom Lane d961a56899 Avoid unnecessary palloc overhead in _bt_first(). The temporary
scankeys arrays that it needs can never have more than INDEX_MAX_KEYS
entries, so it's reasonable to just allocate them as fixed-size local
arrays, and save the cost of palloc/pfree.  Not a huge savings, but
a cycle saved is a cycle earned ...
2005-06-19 22:41:00 +00:00
Tom Lane fc654583ab Need #include <time.h> on some platforms. 2005-06-19 22:34:56 +00:00
Tom Lane 3f749924f8 Simplify uses of readdir() by creating a function ReadDir() that
includes error checking and an appropriate ereport(ERROR) message.
This gets rid of rather tedious and error-prone manipulation of errno,
as well as a Windows-specific bug workaround, at more than a dozen
call sites.  After an idea in a recent patch by Heikki Linnakangas.
2005-06-19 21:34:03 +00:00
Tom Lane e26b0abda3 Arrange to fsync two-phase-commit state files only during checkpoints;
given reasonably short lifespans for prepared transactions, this should
mean that only a small minority of state files ever need to be fsynced
at all.  Per discussion with Heikki Linnakangas.
2005-06-19 20:00:39 +00:00
Bruce Momjian ba90268e2b Add comment about \# in bcc makefiles. 2005-06-19 13:14:20 +00:00
Bruce Momjian 624789d191 Cleanup for Win32 compile.
Andreas Pflug
2005-06-19 13:10:56 +00:00
Bruce Momjian a11333fab7 Fix typo in comment.
Michael Fuhr
2005-06-19 01:06:12 +00:00
Tom Lane 6a6f2d91d4 When using C-string lookup keys in a dynahash.c hash table, use strncpy()
not memcpy() to copy the offered key into the hash table during HASH_ENTER.
This avoids possible core dump if the passed key is located very near the
end of memory.  Per report from Stefan Kaltenbrunner.
2005-06-18 20:51:30 +00:00
Tom Lane a8d1075f27 Add a time-of-preparation column to the pg_prepared_xacts view, per an
old suggestion by Oliver Jowett.  Also, add a transaction column to the
pg_locks view to show the xid of each transaction holding or awaiting
locks; this allows prepared transactions to be properly associated with
the locks they own.  There was already a column named 'transaction',
and I chose to rename it to 'transactionid' --- since this column is
new in the current devel cycle there should be no backwards compatibility
issue to worry about.
2005-06-18 19:33:42 +00:00
Tom Lane 66b098492e Dept. of second thoughts: regular COMMIT deletes deletable files before
releasing locks, so COMMIT PREPARED should too.
2005-06-18 05:21:09 +00:00
Bruce Momjian 25f8916137 Remove 2phase commit TODO.detail. 2005-06-18 01:51:03 +00:00
Bruce Momjian 5117da7b37 Remove TODO.detail.
< * -Add two-phase commit [2phase]
> * -Add two-phase commit
2005-06-18 01:45:58 +00:00
Bruce Momjian 5f98a6f7a3 Done:
< * Add two-phase commit [2phase]
> * -Add two-phase commit [2phase]
2005-06-18 01:45:03 +00:00
Tom Lane d0a89683a3 Two-phase commit. Original patch by Heikki Linnakangas, with additional
hacking by Alvaro Herrera and Tom Lane.
2005-06-17 22:32:51 +00:00
Bruce Momjian 5495575903 Re-order item.
> * Auto-fill the free space map by scanning the buffer cache or by
>   checking pages written by the background writer
< * Auto-fill the free space map by scanning the buffer cache or by
<   checking pages written by the background writer
2005-06-17 19:20:27 +00:00
Bruce Momjian 524ec00d3e Move item:
* Auto-fill the free space map by scanning the buffer cache or by
  checking pages written by the background writer
2005-06-17 13:47:24 +00:00
Bruce Momjian 30b0f49ce6 Update NetBSD 'options' description.
Kris Jurka
2005-06-17 13:12:01 +00:00
Bruce Momjian 1414707e03 Improve wording of read-only GUC variables; shows -> reports. 2005-06-17 03:25:51 +00:00
Bruce Momjian 1b618e50a6 Add:
>
> * Create a bitmap of pages that need vacuuming
>
>   Instead of sequentially scanning the entire table, have the background
>   writer or some other process record pages that have expired rows, then
>   VACUUM can look at just those pages rather than the entire table.  In
>   the event of a system crash, the bitmap would probably be invalidated.
2005-06-17 02:20:43 +00:00
Bruce Momjian a6c7e843da Update GUC description for kerberos usernames. 2005-06-16 20:47:20 +00:00
Bruce Momjian 26cbccd52c Add fsync() define for Win32 to cover cases other than wal_sync_method
where we need fsync().
2005-06-16 17:53:54 +00:00
Bruce Momjian e046b3ddd7 Add \x hex support to ecpg strings. This just passes them to the backend. 2005-06-16 01:43:48 +00:00
Bruce Momjian d1944de61b Move SYMMETRIC/ASYMMETRIC to reserved words to avoid shift/reduce conflicts. 2005-06-15 19:44:05 +00:00
Bruce Momjian 07b80eb301 Improve comment wording. 2005-06-15 16:28:06 +00:00
Tom Lane e5a11a8879 Improve hash method for bitmapsets: some examination of actual outputs
shows that adding a circular shift between words greatly improves the
distribution of hash outputs.
2005-06-15 16:24:07 +00:00
Bruce Momjian 1f01d59e06 Fix display of database name during autovacuum.
Cosimo Streppone
2005-06-15 13:55:23 +00:00
Bruce Momjian 2becf48483 Update catalog version for recent function additions. 2005-06-15 12:56:35 +00:00
Neil Conway c119c5bd49 Change the implementation of hash join to attempt to avoid unnecessary
work if either of the join relations are empty. The logic is:

(1) if the inner relation's startup cost is less than the outer
    relation's startup cost and this is not an outer join, read
    a single tuple from the inner relation via ExecHash()
      - if NULL, we're done

(2) read a single tuple from the outer relation
      - if NULL, we're done

(3) build the hash table on the inner relation
      - if hash table is empty and this is not an outer join,
        we're done

(4) otherwise, do hash join as usual

The implementation uses the new MultiExecProcNode API, per a
suggestion from Tom: invoking ExecHash() now produces the first
tuple from the Hash node's child node, whereas MultiExecHash()
builds the hash table.

I had to put in a bit of a kludge to get the row count returned
for EXPLAIN ANALYZE to be correct: since ExecHash() is invoked to
return a tuple, and then MultiExecHash() is invoked, we would
return one too many tuples to EXPLAIN ANALYZE. I hacked around
this by just manually detecting this situation and subtracting 1
from the EXPLAIN ANALYZE row count.
2005-06-15 07:27:44 +00:00
Neil Conway 4aaff55359 Minor SGML markup cleanup. 2005-06-15 06:29:25 +00:00
Bruce Momjian f4d907ca85 Remove old *.backup files when we do pg_stop_backup(). This
prevents a large number of *.backup files from existing in pg_xlog/
2005-06-15 01:36:08 +00:00
Bruce Momjian 713507b02d Mention we now support BETWEEN SYMMETRIC.
Christopher Kings-Lynne
2005-06-15 01:28:43 +00:00
Bruce Momjian d092524418 > Here's a patch I added against plperl, originally against beta5, now
> against rc1. It simply checks with GetDatabaseEncoding() if the current
> database is in UTF-8, and if so, sets the UTF-8 flag on the arguments
> that are passed to perl. This means that it isn't necessary to
> utf8::upgrade() every string, as perl has no way of knowing offhand
> that a string is UTF-8 -- but postgres does, because the database
> encoding is specified, so it makes sense to turn the flag on. You
> should also be able to properly manipulate UTF-8 strings now from
> plperl as opposed to plperlu, because otherwise you'd have to use
> encoding 'utf8' which was not allowed. It could also eliminate some
> unexpected bugs if you assume that perl knows the string is unicode.
It
> is enabled only for perl 5.6 and higher, so earlier versions will not
> be affected.
>
> I have been assured by crab that the patch is quite harmless and will
> not break anything. It would be great to see it in 8 final! :-)

David Kamholz
2005-06-15 00:35:16 +00:00
Bruce Momjian 0851a6fbc7 This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Magnus Hagander
2005-06-15 00:34:11 +00:00
Bruce Momjian 5955945828 Support 3 and 4-byte unicode characters.
John Hansen
2005-06-15 00:15:08 +00:00
Bruce Momjian f4c4f1ce52 >> Do you agree that using a hashtable for it in general is a good idea
>> assuming this sideeffect is removed, though?
>
>I have no problem with the hashtable, only with preloading it with
>everything.  What I'd like to see is that the table inherited at fork()
>contains just the data for the default timezone.  (At least in the
>normal case where that setting hasn't been changed since postmaster
>start.)

Here's a patch doing this. Changes score_timezone not to use pg_tzset(),
and thus not loading all the zones in the cache. The actual timezone
being picked will be set using set_global_timezone() which in turn calls
pg_tzset() and loads it in the cache.

Magnus Hagander
2005-06-15 00:09:26 +00:00
Bruce Momjian b4132fd0ac Now \d show tablespace of indices per discussion.
test=# \d e
       Table "public.e"
 Column |  Type   | Modifiers
--------+---------+-----------
 i      | integer | not null
 j      | integer | not null
 k      | integer |
Indexes:
    "e_pkey" PRIMARY KEY, btree (i, j), tablespace "haha"
    "ei" btree (i)
    "ej" btree (j), tablespace "haha"
    "ek" btree (k)
Tablespace: "haha"

Qingqing Zhou
2005-06-14 23:59:31 +00:00