Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-06 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > > "Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > > OK, I've been looking at Hiroshi's implementation. It's basically > > semantically equivalent to mine from what I can see so far. The only > > difference really

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-05 Thread Tom Lane
"Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > 1. I'm going to prevent people from dropping the last column in their table. > I think this is the safest option. How do I check if there's any other non > dropped columns in a table? Reference code anywhere? You look through the Relation'

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-05 Thread Tom Lane
"Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: >> What happens if I drop an inherited column in a child table? Maybe it >> works, but what happens when I SELECT the column in the parent table? > Well, what happens if you rename a column in a child table? Same problem? Ideally we should

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-05 Thread Bruce Momjian
Rod Taylor wrote: > > We could change pg_attribute to another name, and create a view called > > pg_attribute that never returned isdropped columns to the client. That > > would allow clients to work cleanly, and the server to work cleanly. > > Another case where having an informational schema w

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-05 Thread Christopher Kings-Lynne
> > Well, what happens if you rename a column in a child table? > Same problem? > > It merrily renames the column in the child table (I tried it). When > SELECTing the parent, bogus data appears. Looks like a bug to me. > Maybe the ALTER TABLE ... RENAME COLUMN code should check for inherite

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-05 Thread Bruce Momjian
The problem is that the new column is now part of pg_attribute so every catalog/pg_attribute.h DATA() line has to be updated. Did you update them all with 'false' in the right slot? Not sure what the chunks are. --- Chri

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Largely-illusory? Almost every pg_attribute query will have to be modified > for isdropped, while Hiroshi's approach requires so few changes, we are > having trouble even finding a query that needs to be modified. That's > pretty clear to me. Apparent

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Bruce Momjian
Thomas Lockhart wrote: > > Well in the renumbering case, the client needs to know about missing attnos > > and it has to know to ignore negative attnos (which it probably does > > already). ie. psql and pg_dump wouldn't have to be modified in that case. > > In the isdropped case, the client needs

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Christopher Kings-Lynne
> BTW there seems a misunderstanding about my posting. > I'm not objecting to add attisdropped pg_attribute column. > They are essentially the same and so I used macros > like COLUMN_IS_DROPPED in my implementation so that > I can easily change the implementation to use isdropped > pg_attribute col

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Hiroshi Inoue
Tom Lane wrote: > > "Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > > OK, I've been looking at Hiroshi's implementation. It's basically > > semantically equivalent to mine from what I can see so far. The only > > difference really is in how the dropped columns are marked. > > True enoug

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Dave Page
> -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > Sent: 04 July 2002 07:40 > To: Tom Lane > Cc: Christopher Kings-Lynne; Hiroshi Inoue; Hackers > Subject: Re: [HACKERS] BETWEEN Node & DROP COLUMN > > > Well, why shouldn't w

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Christopher Kings-Lynne
> My problem is that you are pushing the DROP COLUMN check out into almost > every client that uses pg_attribute. And we are doing this to keep our > backend cleaner. Seems we should do the work once, in the backend, and > not burden clients will all of this. As a user of Postgres, I found the

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Hiroshi Inoue
Tom Lane wrote: > > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> Actually, your trial required column dropped-ness to be checked in > >> many more places than the proposed approach does. > > > Have you ever really checked my trial implementation ? > > Well, I've certainly s

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Christopher Kings-Lynne
> > No, he only breaks even for client cleanliness --- either approach > > *will* require changes in clients that look at pg_attribute. > > Uh, Christopher already indicated three clients, psql, pg_dump, and > another that will not require changes for Hiroshi's approach, but will > require change

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Bruce Momjian
Tom Lane wrote: > "Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > > OK, I've been looking at Hiroshi's implementation. It's basically > > semantically equivalent to mine from what I can see so far. The only > > difference really is in how the dropped columns are marked. > > True enough,

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Tom Lane
"Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > What happens if someone drops ALL the columns in a table? Good point. Ideally we should allow that, but in practice I suspect there are many places that will blow up on zero-length tuples. Rejecting the situation might be the better part of

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Christopher Kings-Lynne
> True enough, but that's not a trivial difference. The problem with > Hiroshi's implementation is that there's no longer a close tie between > pg_attribute.attnum and physical positions of datums in tuples. I think > that that's going to affect a lot of low-level code, and that he hasn't > foun

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Christopher Kings-Lynne
By the way, What happens if someone drops ALL the columns in a table? Do you just leave it there as-is without any columns or should it be forbidden or should it be interpreted as a drop table? Chris ---(end of broadcast)--- TIP 1: subscribe a

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Well, it seems isdropped is going to have to be checked by _any_ client, > > while holes in the number will have to be checked by _some_ clients. Is > > that accurate? > > What's your point? No client that examines pg_attribute can

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Tom Lane
"Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > OK, I've been looking at Hiroshi's implementation. It's basically > semantically equivalent to mine from what I can see so far. The only > difference really is in how the dropped columns are marked. True enough, but that's not a trivial di

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Christopher Kings-Lynne
> > What's your point? No client that examines pg_attribute can be trusted > > until it's been examined pretty closely (as in, more closely than > > Christopher looked at pg_dump). I'd prefer to see us keep the backend > > simple and trustworthy, rather than pursue a largely-illusory idea that >

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Well, it seems isdropped is going to have to be checked by _any_ client, > while holes in the number will have to be checked by _some_ clients. Is > that accurate? What's your point? No client that examines pg_attribute can be trusted until it's been

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Well, it seems isdropped is going to have to be checked by _any_ client, > > while holes in the number will have to be checked by _some_ clients. Is > > that accurate? > > What's your point? No client that examines pg_attribute can

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Tom Lane
Hiroshi Inoue <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Actually, your trial required column dropped-ness to be checked in >> many more places than the proposed approach does. > Have you ever really checked my trial implementation ? Well, I've certainly stumbled over it in places like rel

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Bruce Momjian
Tom Lane wrote: > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> Actually, your trial required column dropped-ness to be checked in > >> many more places than the proposed approach does. > > > Have you ever really checked my trial implementation ? > > Well, I've certainly stu

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> No, he only breaks even for client cleanliness --- either approach > >> *will* require changes in clients that look at pg_attribute. > > > Uh, Christopher already indicated three clients, psql, pg_dump, and > > a

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Hiroshi Inoue
Tom Lane wrote: > > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > > I used the following macro in my trial implementation. > > #define COLUMN_IS_DROPPED(attribute) ((attribute)->attnum <= > > DROP_COLUMN_OFFSET) > > The places where the macro was put are exactly the places > > where attisdropped mu

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> No, he only breaks even for client cleanliness --- either approach >> *will* require changes in clients that look at pg_attribute. > Uh, Christopher already indicated three clients, psql, pg_dump, and > another that will not require c

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-04 Thread Thomas Lockhart
> Well in the renumbering case, the client needs to know about missing attnos > and it has to know to ignore negative attnos (which it probably does > already). ie. psql and pg_dump wouldn't have to be modified in that case. > In the isdropped case, the client needs to know to exclude any column

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > It may turn out to be a choice of client-cleanliness vs. backend > > cleanliness. Seems Hiroshi already wins for client cleanliness. > > No, he only breaks even for client cleanliness --- either approach > *will* require changes in

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > It may turn out to be a choice of client-cleanliness vs. backend > cleanliness. Seems Hiroshi already wins for client cleanliness. No, he only breaks even for client cleanliness --- either approach *will* require changes in clients that look at pg_attr

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Tom Lane wrote: > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > > I used the following macro in my trial implementation. > > #define COLUMN_IS_DROPPED(attribute) ((attribute)->attnum <= > > DROP_COLUMN_OFFSET) > > The places where the macro was put are exactly the places > > where attisdropped mus

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Christopher Kings-Lynne wrote: > > Unfortunately many apps rely on the fact that the attnos are > > consecutive starting from 1. It was the main reason why Tom > > rejected my trial. Nothing has changed about it. > > OK, I've been looking at Hiroshi's implementation. It's basically > semanticall

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Tom Lane
Hiroshi Inoue <[EMAIL PROTECTED]> writes: > I used the following macro in my trial implementation. > #define COLUMN_IS_DROPPED(attribute) ((attribute)->attnum <= > DROP_COLUMN_OFFSET) > The places where the macro was put are exactly the places > where attisdropped must be checked. Actually, you

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Christopher Kings-Lynne
> Unfortunately many apps rely on the fact that the attnos are > consecutive starting from 1. It was the main reason why Tom > rejected my trial. Nothing has changed about it. OK, I've been looking at Hiroshi's implementation. It's basically semantically equivalent to mine from what I can see so

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Christopher Kings-Lynne wrote: > > > Well, obviously I prefer the attisdropped approach. I think > > it's clearer > > > and there's less confusion. As a head developer for phpPgAdmin > > that's what > > > I'd prefer... Hiroshi obviously prefers his solution, but > > doesn't object to > > > > OK

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Christopher Kings-Lynne
> > Well, obviously I prefer the attisdropped approach. I think > it's clearer > > and there's less confusion. As a head developer for phpPgAdmin > that's what > > I'd prefer... Hiroshi obviously prefers his solution, but > doesn't object to > > OK, can you explain the issues from a server and

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Christopher Kings-Lynne
> > I am thinking of rolling back my CVS to see if there's code from your > > previous test implementation that we can use. Apart from the DropColumn > > function itself, what other changes did you make? Did you have > > modifications for '*' expansion in the parser, etc.? > > Yes, please review

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Hiroshi Inoue
Christopher Kings-Lynne wrote: > > > > > > Yes, please remind me. Was your solution renumbering the > > attno values? > > > > > > > > Yes though I don't intend to object to Christopher's proposal. > > Hiroshi, > > I am thinking of rolling back my CVS to see if there's code from your > previous

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Christopher Kings-Lynne
> > > > Yes, please remind me. Was your solution renumbering the > attno values? > > > > > > Yes though I don't intend to object to Christopher's proposal. Hiroshi, I am thinking of rolling back my CVS to see if there's code from your previous test implementation that we can use. Apart from the

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Christopher Kings-Lynne wrote: > > > I am thinking of rolling back my CVS to see if there's code from your > > > previous test implementation that we can use. Apart from the DropColumn > > > function itself, what other changes did you make? Did you have > > > modifications for '*' expansion in t

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Christopher Kings-Lynne wrote: > > > > > Yes, please remind me. Was your solution renumbering the > > attno values? > > > > > > > > Yes though I don't intend to object to Christopher's proposal. > > Hiroshi, > > I am thinking of rolling back my CVS to see if there's code from your > previous te

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > > > > Hiroshi Inoue wrote: > > > > > As I remember, Hiroshi's drop column changed the attribute number to a > > > > > special negative value, which required lots of changes to track. > > > > > > > > ??? What do you mean

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > > As I remember, Hiroshi's drop column changed the attribute number to a > > > special negative value, which required lots of changes to track. > > > > ??? What do you mean by *lots of* ? > > Yes, please remind me. Was your solution renumbering t

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > > > Hiroshi Inoue wrote: > > > > As I remember, Hiroshi's drop column changed the attribute number to a > > > > special negative value, which required lots of changes to track. > > > > > > ??? What do you mean by *lots of* ? > > > > Yes, please rem

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Hiroshi Inoue wrote: > > As I remember, Hiroshi's drop column changed the attribute number to a > > special negative value, which required lots of changes to track. > > ??? What do you mean by *lots of* ? Yes, please remind me. Was your solution renumbering the attno values? I think there are

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Christopher Kings-Lynne wrote: > > Hi All, > > > > I have given up working on the BETWEEN node. It got to the stage where I > > realised I was really out of my depth! Rod Taylor has indicated an interest > > in the problem and I have sent him my latest patch, so hopefu

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Bruce Momjian
Christopher Kings-Lynne wrote: > Hi All, > > I have given up working on the BETWEEN node. It got to the stage where I > realised I was really out of my depth! Rod Taylor has indicated an interest > in the problem and I have sent him my latest patch, so hopefully he'll be > able to crack it. > >

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Hannu Krosing
On Wed, 2002-07-03 at 14:32, Rod Taylor wrote: > > > It should also be noted that an ALTER TABLE / SET TYPE implemented with > > > the above idea with run into the 2x diskspace issue as well as take > > > quite a while to process. > > > > I think that if the 'SET TYPE' operation is ever to be rol

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Rod Taylor
> > It should also be noted that an ALTER TABLE / SET TYPE implemented with > > the above idea with run into the 2x diskspace issue as well as take > > quite a while to process. > > I think that if the 'SET TYPE' operation is ever to be rollback-able, it > will need to use 2x diskspace. If it's

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Christopher Kings-Lynne
> I've not looked in a while, but the column rename code did not account > for issues in foreign keys, etc. Those should be easier to ferret out > soon, but may not be so nice to change yet. Which is probably a good reason for us to offer it as an all-in-one command, rather than expecting them t

Re: [HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Rod Taylor
> all values, drop the old col). So, there is no reason why this new > attisdropped field shouldn't allow us to implement a full ALTER TABLE/SET > TYPE sort of feature - cool huh? I've not looked in a while, but the column rename code did not account for issues in foreign keys, etc. Those shou

[HACKERS] BETWEEN Node & DROP COLUMN

2002-07-03 Thread Christopher Kings-Lynne
Hi All, I have given up working on the BETWEEN node. It got to the stage where I realised I was really out of my depth! Rod Taylor has indicated an interest in the problem and I have sent him my latest patch, so hopefully he'll be able to crack it. So instead, I've taken up with the DROP COLUM