[BUGS] BUG #3882: unexpected PARAM_SUBLINK ID

2008-01-17 Thread Jan Mate

The following bug has been logged online:

Bug reference:  3882
Logged by:  Jan Mate
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.2.6
Operating system:   Linux and Mac OS X
Description:unexpected PARAM_SUBLINK ID
Details: 

I am trying to create a row versioning table using view and rules.

The problem occur when I try to insert a new row to view using:

INSERT INTO "table" (number, level) VALUES(1, 1);

I get the following error:
ERROR:  unexpected PARAM_SUBLINK ID: 3

BUT, the same INSERT RULE (see the dump below) works fine when I delete the
"limited" column from the table (and view) and modify the rules on the
view:

Dump of my DB is:

--
-- PostgreSQL database dump
--

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

SET search_path = public, pg_catalog;

DROP RULE "_INSERT" ON public."table";
DROP INDEX public."r_table#_id#key";
ALTER TABLE ONLY public."r_table" DROP CONSTRAINT "r_table#pkey";
DROP SEQUENCE public."r_table#__id_entry#seq";
DROP VIEW public."table";
DROP TABLE public."r_table";
DROP SEQUENCE public."r_table#_id#seq";

--
-- Name: r_table#_id#seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE "r_table#_id#seq"
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1
CYCLE;


SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: r_table; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE "r_table" (
_id bigint DEFAULT nextval('"r_table#_id#seq"'::regclass) NOT NULL,
__version bigint NOT NULL,
__latest boolean DEFAULT false NOT NULL,
__op_type text NOT NULL,
__timestamp timestamp without time zone NOT NULL,
__id_entry bigint NOT NULL,
number bigint NOT NULL,
limited timestamp without time zone,
"level" bigint DEFAULT 1 NOT NULL
);


--
-- Name: table; Type: VIEW; Schema: public; Owner: -
--
-- Select only the latest version of rows if they are not DELETED

CREATE VIEW "table" AS
SELECT "r_table"._id, "r_table".number, "r_table".limited,
"r_table"."level" FROM "r_table" WHERE "r_table".__id_entry,
"r_table".__version) IN (SELECT "r_table".__id_entry,
max("r_table".__version) AS __version FROM "r_table" GROUP BY
"r_table".__id_entry)) AND ("r_table".__op_type <> 'DELETE'::text)) AND
("r_table".__latest = true));


--
-- Name: r_table#__id_entry#seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE "r_table#__id_entry#seq"
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;


--
-- Name: r_table#pkey; Type: CONSTRAINT; Schema: public; Owner: -;
Tablespace: 
--

ALTER TABLE ONLY "r_table"
ADD CONSTRAINT "r_table#pkey" PRIMARY KEY (_id);


--
-- Name: r_table#_id#key; Type: INDEX; Schema: public; Owner: -; Tablespace:

--

CREATE UNIQUE INDEX "r_table#_id#key" ON "r_table" USING btree (_id);


--
-- Name: _INSERT; Type: RULE; Schema: public; Owner: -
--
-- Insert the new row only if there is not duplicate row in view

CREATE RULE "_INSERT" AS ON INSERT TO "table" DO INSTEAD INSERT INTO
"r_table" (__version, __latest, __op_type, __timestamp, __id_entry, number,
limited, "level") VALUES (0, true, 'INSERT'::text, now(),
nextval('"r_table#__id_entry#seq"'::regclass), (SELECT new.number WHERE (NOT
((new.number, new.limited, new."level") IN (SELECT "table".number,
"table".limited, "table"."level" FROM "table", new.limited,
new."level");

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[BUGS] BUG #3937: timestamp null value comparison in subquery using IN/NOT IN

2008-02-06 Thread Jan Mate

The following bug has been logged online:

Bug reference:  3937
Logged by:  Jan Mate
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.2.6
Operating system:   Linux & Mac OS X
Description:timestamp null value comparison in subquery using IN/NOT
IN
Details: 

Comparison between null and timestamp null value is not correct.

Try this example:

CREATE TABLE _test ("timestamp" timestamp);
INSERT INTO _test (timestamp) VALUES (null);

SELECT 1 WHERE (null) NOT IN (SELECT * FROM _test);
 ?column? 
--
(0 rows)

SELECT 1 WHERE (null) IN (SELECT * FROM _test);
 ?column? 
--
(0 rows)

Is there any other way to compare the subquery result (using IN or NOT IN)
with null value?

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[BUGS] BUG #7838: pg_dump major bug

2013-01-30 Thread jan . mate
The following bug has been logged on the website:

Bug reference:  7838
Logged by:  Jan Mate
Email address:  jan.m...@inf-it.com
PostgreSQL version: 9.2.2
Operating system:   Debian GNU/Linux
Description:

Today I tried to upgrade from 9.1.7 to 9.2.2 by using:

pg_upgradecluster 9.1 main

The upgrade process failed on one of my VIEWS with syntax error (after I
removed that VIEW, the upgrade process worked well - also there was no
problem with re-creation of the VIEW after the upgrade).

I created a very simple example to reproduce the problem (looks like it is a
pg_dump problem). Here are the links to files used in my example:

- my original SQL queries
http://www.inf-it.com/fixes/postgres-bugreport/test.sql

- result from the pg_dump
http://www.inf-it.com/fixes/postgres-bugreport/test_dump.sql

Steps to reproduce the problem:
$ createdb test
$ psql test < test.sql
$ psql test -c 'SELECT * FROM export_data;'
  number   | org  | 
 name
  
+--+--
551212 | Starfleet or Springfield Nuclear Power Plant | Simpson
Homer or Picard Jean-Luc
(1 row)
$ pg_dump test > test_dump.sql
$ dropdb test
$ createdb test
$ psql test < test_dump.sql
   SET
   SET
   SET
   SET
   SET
   CREATE EXTENSION
   COMMENT
   SET
   SET
   SET
   CREATE TABLE
   ALTER TABLE
   ERROR:  syntax error at or near "["
   LINE 2: ...i'::text) regexp_matches(regexp_matches) LIMIT 1))[1],
'[\\]...
^
   ERROR:  relation "public.export_data" does not exist
   REVOKE
   REVOKE
   GRANT
   GRANT




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


[BUGS] BUG #8465: major dump/reload problem

2013-09-22 Thread jan . mate
The following bug has been logged on the website:

Bug reference:  8465
Logged by:  Jan Mate
Email address:  jan.m...@inf-it.com
PostgreSQL version: 9.3.0
Operating system:   all
Description:



Hi PostgreSQL team,


today I tried to upgrade from 9.2 to 9.3 (pg_upgradecluster 9.2 main) and
the upgrade of one of my databases failed with the following error: "ERROR: 
new row for relation ... violates check constraint ...".


I created an example to reproduce this bug:


http://www.inf-it.com/fixes/postgres-bugreport2/schema.sql


steps to reproduce it (tested with version 9.3):


createdb test && psql test < schema.sql
pg_dump test > dump.sql


dropdb test && createdb test && psql test < dump.sql




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