Re: [HACKERS] Re: Mirroring a DB

Поиск
Список
Период
Сортировка
От Karl DeBisschop
Тема Re: [HACKERS] Re: Mirroring a DB
Дата
Msg-id 199912112132.QAA03247@skillet.infoplease.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: Mirroring a DB  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>   I'm not the god of rules, but I have messed with that code.  Current
>   sources will put table prefixes on every var in a rule if more than one
>   table appears in the rule's rangelist.  I think this should be
>   sufficient, but it's hard to tell from this incomplete example;
>   are you actually complaining about some special case that arises when
>   a column has the same name as its table?

As far as I can see, the problem has nothing to do with whether the
table has the same name as the column.  The problem arises when the
two tables each have attributes with the same name.  So for instance
when t1 has an attribute (say "foriegn_oid") that joins to oid in t2,
the rule gets saved as just "oid" so when recreated, the parser can't
determine which oid to join to.

>   It would be nice to see the original view definition (plus enough table
>   definitions to let us create the rule without guessing).

Sorry, I really didn't think this was an unknown issue, otherwise I
would have sent in a bug report with such details. I think the stuff
below should cover it.  If there's any more info that I can provide,
just ask.

Karl

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

create view element_types as select fcat.ref,fcat.fcat,ecat.ecat,ecat.oid as
ecat_oid,ecat.ord,ecat.emin,ecat.emax,ecat.rowsfrom fcat,ecat where fcat.ref=ecat.fcat;
 

------------------------------------------------------------------------------

feature=> \d fcat 
Table    = fcat
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| ref                              | int2 not null                    |     2 |
| owner                            | int2 not null                    |     2 |
| fcat                             | text not null                    |   var |
+----------------------------------+----------------------------------+-------+
feature=> \d ecat
Table    = ecat
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| fcat                             | int2 not null                    |     2 |
| ord                              | int2 not null                    |     2 |
| emin                             | int2 not null                    |     2 |
| emax                             | int2                             |     2 |
| rows                             | int2 not null                    |     2 |
| ecat                             | text not null                    |   var |
+----------------------------------+----------------------------------+-------+
Index:    zecat_sf



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] LONG
Следующее
От: Karl DeBisschop
Дата:
Сообщение: Re: [HACKERS] Re: Mirroring a DB