Re: [HACKERS] pg_attribute.attisinherited ?

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: Alvaro Herrera <alvherre(at)atentus(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] pg_attribute.attisinherited ?
Date: 2002-08-24 22:49:12
Message-ID: 20020824184912.13f4b492.alvherre@atentus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

En Sat, 24 Aug 2002 17:09:55 -0400
I said:

> > I remember Tom suggested adding something like attisinherited and
> > preventing this kind of operations on such attributes, because one can
> > do things such as [...]

Ok, I attach a patch that does this. It doesn't include regression
tests, docs nor the checks against unwanted operations; these will come
later if people think this is a good approach.

It passes 86 of 88 tests. The 2 failures are ordering issues (diff
below) I don't know what causes it.

Please review.

*** ./expected/select_having.out Wed Jun 26 17:58:56 2002
--- ./results/select_having.out Sat Aug 24 18:32:16 2002
***************
*** 26,33 ****
GROUP BY b, c HAVING b = 3;
b | c
---+----------
- 3 | BBBB
3 | bbbb
(2 rows)

SELECT lower(c), count(c) FROM test_having
--- 26,33 ----
GROUP BY b, c HAVING b = 3;
b | c
---+----------
3 | bbbb
+ 3 | BBBB
(2 rows)

SELECT lower(c), count(c) FROM test_having
***************
*** 43,50 ****
GROUP BY c HAVING count(*) > 2 OR min(a) = max(a);
c | max
----------+-----
- XXXX | 0
bbbb | 5
(2 rows)

DROP TABLE test_having;
--- 43,50 ----
GROUP BY c HAVING count(*) > 2 OR min(a) = max(a);
c | max
----------+-----
bbbb | 5
+ XXXX | 0
(2 rows)

DROP TABLE test_having;

======================================================================

*** ./expected/rules.out Mon Aug 19 01:08:30 2002
--- ./results/rules.out Sat Aug 24 18:32:46 2002
***************
*** 404,412 ****
----------------------+--------------+------------+------------+------------
gates | t | fired | $0.00 | $80,000.00
gates | t | hired | $80,000.00 | $0.00
- wiech | t | hired | $5,000.00 | $0.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
(5 rows)

insert into rtest_empmass values ('meyer', '4000.00');
--- 404,412 ----
----------------------+--------------+------------+------------+------------
gates | t | fired | $0.00 | $80,000.00
gates | t | hired | $80,000.00 | $0.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
+ wiech | t | hired | $5,000.00 | $0.00
(5 rows)

insert into rtest_empmass values ('meyer', '4000.00');
***************
*** 421,429 ****
maier | t | hired | $5,000.00 | $0.00
mayr | t | hired | $6,000.00 | $0.00
meyer | t | hired | $4,000.00 | $0.00
- wiech | t | hired | $5,000.00 | $0.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
(8 rows)

update rtest_empmass set salary = salary + '1000.00';
--- 421,429 ----
maier | t | hired | $5,000.00 | $0.00
mayr | t | hired | $6,000.00 | $0.00
meyer | t | hired | $4,000.00 | $0.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
+ wiech | t | hired | $5,000.00 | $0.00
(8 rows)

update rtest_empmass set salary = salary + '1000.00';
***************
*** 439,447 ****
mayr | t | honored | $7,000.00 | $6,000.00
meyer | t | hired | $4,000.00 | $0.00
meyer | t | honored | $5,000.00 | $4,000.00
- wiech | t | hired | $5,000.00 | $0.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
(11 rows)

delete from rtest_emp where ename = rtest_empmass.ename;
--- 439,447 ----
mayr | t | honored | $7,000.00 | $6,000.00
meyer | t | hired | $4,000.00 | $0.00
meyer | t | honored | $5,000.00 | $4,000.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
+ wiech | t | hired | $5,000.00 | $0.00
(11 rows)

delete from rtest_emp where ename = rtest_empmass.ename;
***************
*** 459,467 ****
meyer | t | fired | $0.00 | $5,000.00
meyer | t | hired | $4,000.00 | $0.00
meyer | t | honored | $5,000.00 | $4,000.00
- wiech | t | hired | $5,000.00 | $0.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
(14 rows)

--
--- 459,467 ----
meyer | t | fired | $0.00 | $5,000.00
meyer | t | hired | $4,000.00 | $0.00
meyer | t | honored | $5,000.00 | $4,000.00
wieck | t | honored | $6,000.00 | $5,000.00
wieck | t | honored | $7,000.00 | $6,000.00
+ wiech | t | hired | $5,000.00 | $0.00
(14 rows)

--

======================================================================

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Un poeta es un mundo encerrado en un hombre" (Victor Hugo)

Attachment Content-Type Size
attisinherited-3.patch application/octet-stream 50.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-25 09:34:21 Re: [HACKERS] pg_attribute.attisinherited ?
Previous Message Alvaro Herrera 2002-08-24 21:09:55 Re: pg_attribute.attisinherited ?

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2002-08-25 05:08:01 CREATE INDEX error message
Previous Message Alvaro Herrera 2002-08-24 21:09:55 Re: pg_attribute.attisinherited ?