Re: if row has property X, find all rows that has property X

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: if row has property X, find all rows that has property X
Date: 2014-06-24 13:40:11
Message-ID: 1403617211949-5808888.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Дмитрий Голубь wrote
> For example I have table addresses and usually I want 2 things:
> 1. Find id of bad addresses.
> 2. Check if this address is good or bad.
>
> For this I write two plpgsql functions
> 1. find_all_bad_addresses
> 2. is_bad_address(id)
>
> These functions will duplicate logic of each other. How to not repeat
> myself?

You can call other functions while inside a function......

CREATE FUNCTION do_a() ... $$ do_something; $$
CREATE FUNCTION do_b() ... $$ do_a(); $$

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/if-row-has-property-X-find-all-rows-that-has-property-X-tp5808885p5808888.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Heikki Linnakangas 2014-06-24 14:02:38 Re: Extended Prefetching using Asynchronous IO - proposal and patch
Previous Message Дмитрий Голубь 2014-06-24 13:32:14 if row has property X, find all rows that has property X