Alvaro Herrera wrote:
> Stuart Bishop wrote:

> > The test case (invisible.sh) and required dump (foodump.sql - 60k) are
> > at http://www.stuartbishop.net/invisible/
> 
> Got it, thanks, looking.

Here's a slightly smaller test case; basically I removed the tsearch2
cruft and extra columns in the table.  One thing of note is that if the
COPY commands is reduced to occupy less than one page in the target
table, the problem does not occur.

To reproduce, restore the attached file and run
BEGIN;
SET transaction_isolation TO SERIALIZABLE;
UPDATE Bug2 SET name='foobar' WHERE id=1;
ABORT;


-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: plpythonu; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: alvherre
--

CREATE PROCEDURAL LANGUAGE plpythonu;


ALTER PROCEDURAL LANGUAGE plpythonu OWNER TO alvherre;

SET search_path = public, pg_catalog;

--
-- Name: ftiupdate(); Type: FUNCTION; Schema: public; Owner: alvherre
--

CREATE FUNCTION ftiupdate() RETURNS trigger
    LANGUAGE plpythonu
    AS $_$
            new = TD["new"]
            args = TD["args"][:]

            # Short circuit if none of the relevant columns have been
            # modified and fti is not being set to NULL (setting the fti
            # column to NULL is thus how we can force a rebuild of the fti
            # column).
            if TD["event"] == "UPDATE" and new["fti"] != None:
                old = TD["old"]
                relevant_modification = False
                for column_name in args[::2]:
                    if new[column_name] != old[column_name]:
                        relevant_modification = True
                        break
                if not relevant_modification:
                    return "OK"

            # Generate an SQL statement that turns the requested
            # column values into a weighted tsvector
            sql = []
            for i in range(0, len(args), 2):
                sql.append(
                        "setweight(to_tsvector('english'::regconfig, coalesce("
                        "substring(ltrim($%d) from 1 for 2500),'')),"
                        "CAST($%d AS \"char\"))" % (i + 1, i + 2))
                args[i] = new[args[i]]

            sql = "SELECT %s AS fti" % "||".join(sql)

            # Execute and store in the fti column
            plan = plpy.prepare(sql, ["text", "char"] * (len(args)/2))
            new["fti"] = plpy.execute(plan, args, 1)[0]["fti"]

            # Tell PostgreSQL we have modified the data
            return "MODIFY"
        $_$;


ALTER FUNCTION public.ftiupdate() OWNER TO alvherre;

--
-- Name: FUNCTION ftiupdate(); Type: COMMENT; Schema: public; Owner: alvherre
--

COMMENT ON FUNCTION ftiupdate() IS 'Trigger function that keeps the fti 
tsvector column up to date.';


SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: bug2; Type: TABLE; Schema: public; Owner: alvherre; Tablespace: 
--

CREATE TABLE bug2 (
    id integer,
    name text,
    title text,
    description text,
    fti tsvector
);


ALTER TABLE public.bug2 OWNER TO alvherre;

--
-- Name: bug_id_seq; Type: SEQUENCE; Schema: public; Owner: stub
--

CREATE SEQUENCE bug_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.bug_id_seq OWNER TO stub;

--
-- Name: bug_id_seq; Type: SEQUENCE SET; Schema: public; Owner: stub
--

SELECT pg_catalog.setval('bug_id_seq', 15, true);


--
-- Data for Name: bug2; Type: TABLE DATA; Schema: public; Owner: alvherre
--

COPY bug2 (id, name, title, description, fti) FROM stdin;
1       \N      Firefox does not support SVG    Firefox needs to support 
embedded SVG images, now that the standard has been finalised.\n\nThe SVG 
standard 1.0 is complete, and draft implementations for Firefox exist. One of 
these implementations needs to be integrated with the base install of Firefox. 
Ideally, the implementation needs to include support for the manipulation of 
SVG objects from JavaScript to enable interactive and dynamic SVG drawings.     
   '1.0':23 'base':42 'complet':25 'draft':27 'draw':67 'dynam':65 'embed':10 
'enabl':62 'exist':31 'finalis':19 'firefox':1B,6,30,45 'ideal':46 'imag':12 
'implement':28,35,48 'includ':51 'instal':43 'integr':39 'interact':63 
'javascript':60 'manipul':55 'need':7,36,49 'object':58 'one':32 
'standard':16,22 'support':4B,9,52 'svg':5B,11,21,57,66
2       blackhole       Blackhole Trash folder  The Trash folder seems to have 
significant problems! At the moment, dragging an item to the trash results in 
immediate deletion. The item does not appear in the Trash, it is just deleted 
from my hard disk. There is no undo or ability to recover the deleted file. 
Help!    'abil':47 'appear':30 'blackhol':1A,2B 'delet':25,37,51 'disk':41 
'drag':16 'file':52 'folder':4B,7 'hard':40 'help':53 'immedi':24 'item':18,27 
'moment':15 'problem':12 'recov':49 'result':22 'seem':8 'signific':11 
'trash':3B,6,21,33 'undo':45
13      \N      Launchpad CSS and JS is not testible    The messages placed on 
this bug are for eyeball viewing of JS and CSS behaviour.        'behaviour':22 
'bug':13 'css':2B,21 'eyebal':16 'js':4B,19 'launchpad':1B 'messag':9 
'place':10 'testibl':7B 'view':17
14      \N      jokosher exposes personal details in its actions portlet        
Jokosher discloses to any passerby the fact that I am single and unwed in its 
actions portlet. Please fix this blatant violacion of privacy now!!       
'action':7B,24 'blatant':29 'detail':4B 'disclos':10 'expos':2B 'fact':15 
'fix':27 'jokosh':1B,9 'passerbi':13 'person':3B 'pleas':26 'portlet':8B,25 
'privaci':32 'singl':19 'unw':21 'violacion':30
15      \N      Nonsensical bugs are useless    Like this one, natch.   
'bug':2B 'like':5 'natch':8 'nonsens':1B 'one':7 'useless':4B
3       \N      Bug Title Test  Shirtpkdf u...@domain.org lkjd hlkjfds gkfdsg 
kfd glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug yxoiuy oiugf 
hyoifxugyoixgfuy xoiuyxoiyxoifuy xo\n\ny idu yifdxhfgffxShirtpkdf jlkdsj;lkd 
lkjd hlkjfds gkfdsg kfd glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug 
yxoiuy oiugf hyoifxugyoixgfuy xoiuyxoiyxoifuy xoShirtpkdf jlkdsj;lkd lkjd 
hlkjfds gkfdsg kfd glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug yxoiuy 
oiugf hyoifxugyoixgfuy xoiuyxoiyxoifuy xo\nShirtpkdf jlkdsj;lkd lkjd hlkjfds 
gkfdsg kfd glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug yxoiuy oiugf 
hyoifxugyoixgfuy xoiuyxoiyxoifuy xoShirtpkdf jlkdsj;lkd lkjd hlkjfds gkfdsg kfd 
glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug yxoiuy oiugf 
hyoifxugyoixgfuy xoiuyxoiyxoifuy xo\n\nShirtpkdf jlkdsj;lkd lkjd hlkjfds gkfdsg 
kfd glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug yxoiuy oiugf 
hyoifxugyoixgfuy xoiuyxoiyxoifuy xoShirtpkdf jlkdsj;lkd lkjd hlkjfds gkfdsg kfd 
glkfd gifdsytoxdiytxoiufdytoidxf yxoigfyoigfxuyfxoiug yxoiuy oiugf 
hyoifxugyoixgfuy xoiuyxoiyxoifuy xo   'bug':1B 
'gifdsytoxdiytxoiufdytoidxf':11,28,42,57,71,86,100 'gkfdsg':8,25,39,54,68,83,97 
'glkfd':10,27,41,56,70,85,99 'hlkjfds':7,24,38,53,67,82,96 
'hyoifxugyoixgfuy':15,32,46,61,75,90,104 'idu':19 'jlkdsj':21,35,50,64,79,93 
'kfd':9,26,40,55,69,84,98 'lkd':22,36,51,65,80,94 'lkjd':6,23,37,52,66,81,95 
'oiugf':14,31,45,60,74,89,103 'shirtpkdf':4,49,78 'test':3B 'titl':2B 
'u...@domain.org':5 'xo':17,48,77,106 'xoiuyxoiyxoifuy':16,33,47,62,76,91,105 
'xoshirtpkdf':34,63,92 'y':18 'yifdxhfgffxshirtpkdf':20 
'yxoigfyoigfxuyfxoiug':12,29,43,58,72,87,101 'yxoiuy':13,30,44,59,73,88,102
7       \N      A test bug      A test description      'bug':3B 'descript':6 
'test':2B,5
4       \N      Reflow problems with complex page layouts       Malone pages 
that use more complex layouts with portlets and fancy CSS are sometimes not 
getting properly reflowed after rendering.     'complex':4B,12 'css':18 
'fanci':17 'get':22 'layout':6B,13 'malon':7 'page':5B,8 'portlet':15 
'problem':2B 'proper':23 'reflow':1B,24 'render':26 'sometim':20 'use':10
5       \N      Firefox install instructions should be complete All ways of 
downloading firefox should provide complete install instructions. At present, 
they are only visible on the Release Notes page.      'complet':6B,14 
'download':10 'firefox':1B,11 'instal':2B,15 'instruct':3B,16 'note':26 
'page':27 'present':18 'provid':13 'releas':25 'visibl':22 'way':8
6       \N      Firefox crashes when Save As dialog for a nonexistent window is 
closed  User-Agent:       \nBuild Identifier: Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.6) Gecko/20040207 Firefox/0.8\n\nIf a Save As dialog for a 
nonexistent window exists, when the dialog is closed Firefox will crash.  It's 
possible to cause this to happen using the "Open With/Save As" 
dialog.\n\nReproducible: Always\nSteps to Reproduce:\n1. Visit 
http://www.mozilla.org/products/firefox/\n2. Click on "Download Now!"  An "Open 
With/Save" dialog will appear.\n4. Press OK.\n5. Switch back to the "Open 
With/Save" dialog, and press OK again.  There are now two Save As dialogs.  
This is bug 58777.\n6. Close the second dialog with "Cancel"\n7. Close the 
browser window that started all of this.\n8. Close the first dialog with 
"Cancel".\n\nActual Results:  \nCrash!\n\nExpected Results:  \nNot crashed.     
   '/products/firefox/':71 '1':67 '1.6':27 '2':72 '4':83 '5':86 '58777':108 
'6':109 '7':116 '8':126 'actual':133 'agent':15 'alway':63 'appear':82 
'back':88 'browser':119 'bug':107 'build':16 'cancel':115,132 'caus':52 
'click':73 'close':12B,44,110,117,127 'crash':2B,47,135,139 
'dialog':6B,34,42,61,80,93,104,113,130 'download':75 'en':24 'en-us':23 
'exist':39 'expect':136 'firefox':1B,45 'firefox/0.8':29 'first':129 
'gecko/20040207':28 'happen':55 'i686':22 'identifi':17 'linux':21 
'mozilla/5.0':18 'nonexist':9B,37 'ok':85,96 'open':58,78,91 'possibl':50 
'press':84,95 'reproduc':62,66 'result':134,137 'rv':26 'save':4B,32,102 
'second':112 'start':122 'step':64 'switch':87 'two':101 'u':20 'us':25 
'use':56 'user':14 'user-ag':13 'visit':68 'window':10B,38,120 
'with/save':59,79,92 'www.mozilla.org':70 'www.mozilla.org/products/firefox':69 
'x11':19
8       \N      Printing doesn't work   When I press print in Firefox, nothing 
happens, not even a print dialog comes up.       'come':18 'dialog':17 
'doesn':2B 'even':14 'firefox':10 'happen':12 'noth':11 'press':7 
'print':1B,8,16 'work':4B
9       \N      Thunderbird crashes     Every time I start Thunderbird it 
crashes.      'crash':2B,9 'everi':3 'start':6 'thunderbird':1B,7 'time':4
10      \N      another test bug        test bug        'anoth':1B 'bug':3B,5 
'test':2B,4
11      \N      Make Jokosher use autoaudiosink I've had problems when 
switching from Jokosher to Totem to play an Ogg.\n\nTotem appears to be playing 
normally but does not produce any sound.\nIf I close Jokosher then you can hear 
totem.\n\nI've also had a problem when trying to playback sound within 
jokosher\nafter switch from another app (I think it was xmms). I get a 
dialog\nwith the following text:\n\n     Argh! Something went wrong and a 
serious error occurred:\n\n     Resource busy or not available.\n\n     
gstalsasink.c(636): gst_alsasink_open (): /timeline/playbackbin/\n     
alsasink0:\n     Device 'hw:0' is busy\n\nAfter closing and reopening Jokosher, 
i got the same error again.\nAfter logging out of gnome and logging in again - 
I still got the same\nerror message.\n\nI had to restart!\n\nIs there some way 
to reset alsa or the device driver - with out having\nto restart?\n\nRunning on 
Ubuntu - with Jokosher 0.2 runscript.       '/timeline/playbackbin':90 '0':94 
'0.2':149 '636':86 'alsa':134 'alsasink':88 'alsasink0':91 'also':42 'anoth':56 
'app':57 'appear':20 'argh':71 'autoaudiosink':4B 'avail':84 'busi':81,96 
'close':33,98 'devic':92,137 'dialog':66 'driver':138 'error':78,106,122 
'follow':69 'get':64 'gnome':112 'got':103,119 'gst':87 'gstalsasink.c':85 
'hear':38 'hw':93 'jokosh':2B,12,34,52,101,148 'log':109,114 'make':1B 
'messag':123 'normal':24 'occur':79 'ogg':18 'open':89 'play':16,23 
'playback':49 'problem':8,45 'produc':28 'reopen':100 'reset':133 'resourc':80 
'restart':127,143 'run':144 'runscript':150 'serious':77 'someth':72 
'sound':30,50 'still':118 'switch':10,54 'text':70 'think':59 'totem':14,19,39 
'tri':47 'ubuntu':146 'use':3B 've':6,41 'way':131 'went':73 'within':51 
'wrong':74 'xmms':62
\.


--
-- Name: tsvectorupdate; Type: TRIGGER; Schema: public; Owner: alvherre
--

CREATE TRIGGER tsvectorupdate
    BEFORE INSERT OR UPDATE ON bug2
    FOR EACH ROW
    EXECUTE PROCEDURE ftiupdate('name', 'a', 'title', 'b', 'description', 'd');


--
-- Name: public; Type: ACL; Schema: -; Owner: alvherre
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM alvherre;
GRANT ALL ON SCHEMA public TO alvherre;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to