Обсуждение: daisychain rows to detect value

Поиск
Список
Период
Сортировка

daisychain rows to detect value

От
Gary Stainburn
Дата:
I have a table of network ports. These ports are part of something, be it a 
cabinet patch panel, or a network switch.

np_connects_to references a hardware ID, which can be the cabinet, 
switch,router etc. containing the port.
no_port is the name of the port.
np_untagged_vlan is the VLAN ID for the port, with NULL being allowed.

Each port can then be patched to another port.

For example:


np_connects_to | np_port | np_patch_to | np_patch_port | np_untagged_vlan
---------------+---------+-------------+---------------+-----------------
1              | 01      |             |               | 1
2              | 23B     | 1           | 01            |
3              | 23A     | 2           | 23B           |

Row 1 shows a switch port set to VLAN 1.
Row 2 shows a port in cabiner 'A' (Panel B port 23) which is patched to the 
switch port.
Row 3 shows a port in cabinet 'B' (Panel A port 23) which is the other end 
cabinet A port 23B

Is there a way to be able to propogate the untagged VLAN to any port patched 
to it? 

-- 
https://fundraise.cancerresearchuk.org/page/garys-march-march



Re: daisychain rows to detect value

От
"David G. Johnston"
Дата:
On Mon, Mar 27, 2017 at 2:58 AM, Gary Stainburn <gary.stainburn@ringways.co.uk> wrote:
Is there a way to be able to propogate the untagged VLAN to any port patched
to it?

​PostgreSQL natively provides a Recursive CTE​ capability that can be used to solve arbitrary depth hierarchy problems.


Triggers are useful if you want to do the calculation during writes instead of during reads.


David J.