agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feeddaisychain rows to detect value
2+ messages / 2 participants
[nested] [flat]
* daisychain rows to detect value
@ 2017-03-27 09:58 Gary Stainburn <gary.stainburn@ringways.co.uk>
0 siblings, 1 reply; 2+ messages in thread
From: Gary Stainburn @ 2017-03-27 09:58 UTC (permalink / raw)
To: pgsql-sql
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
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: daisychain rows to detect value
@ 2017-03-27 15:59 David G. Johnston <david.g.johnston@gmail.com>
parent: Gary Stainburn <gary.stainburn@ringways.co.uk>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2017-03-27 15:59 UTC (permalink / raw)
To: Gary Stainburn <gary.stainburn@ringways.co.uk>; +Cc: pgsql-sql
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.
https://www.postgresql.org/docs/current/static/queries-with.html
Triggers are useful if you want to do the calculation during writes instead
of during reads.
https://www.postgresql.org/docs/current/static/trigger-definition.html
David J.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-03-27 15:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 09:58 daisychain rows to detect value Gary Stainburn <gary.stainburn@ringways.co.uk>
2017-03-27 15:59 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox