Re: Re: Changing the default value of an inherited column
От | Christopher Masto |
---|---|
Тема | Re: Re: Changing the default value of an inherited column |
Дата | |
Msg-id | 20010330130739.A27679@netmonger.net обсуждение исходный текст |
Ответ на | Re: Re: Changing the default value of an inherited column (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Re: Changing the default value of an inherited column
|
Список | pgsql-hackers |
On Fri, Mar 30, 2001 at 12:10:59PM -0500, Tom Lane wrote: > Comments? I'm going to implement and commit this today unless I hear > loud squawks ... I like it in general and I think it opens some interesting possibilities. I don't know much about how the inheritance system is implemented, so I will put out this scenario in case it makes a difference. We recently decided to refactor our schema a bit, using inheritance. All of our tables have a primary key called "seq" along with some other common fields such as entry time, etc. We realized that moving them into a "base" table allowed us to create functions on "base" that would work on every derived table. The main problem was that we needed fields like "seq" to have distinct sequences, which was not possible without the ability to override the default value in each derived table. It seems like this would be easily doable with this change. Another thing that seems kind of interesting would be to have: CREATE TABLE base (table_id CHAR(8) NOT NULL [, etc.]); CREATE TABLE foo (table_id CHAR(8) NOT NULL DEFAULT 'foo'); CREATE TABLE bar (table_id CHAR(8) NOT NULL DEFAULT 'foo'); Then a function on "base" could look at table_id and know which table it's working on. A waste of space, but I can think of uses for it. -- Christopher Masto Senior Network Monkey NetMonger Communications chris@netmonger.net info@netmonger.net http://www.netmonger.net Free yourself, free your machine, free the daemon -- http://www.freebsd.org/
В списке pgsql-hackers по дате отправления: