Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3nQs-0002FN-Bb for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2019 20:23:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i3nQq-0008NC-Uz for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2019 20:23:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3nQq-0008Gp-F1 for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2019 20:23:40 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3nQn-0007zJ-MU for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2019 20:23:40 +0000 Received: by mail-pf1-x42d.google.com with SMTP id b24so5362250pfp.1 for ; Fri, 30 Aug 2019 13:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=nciNlSmRjkL2N9Zp9t65K6n3+ndoM89KysRunZ8weo8=; b=CsTnWd0ayGaCpQKt1HjfEfXhE2wUgjdNSHtbQTdIx9Uf1/1BZBF4E2RIU2DmOeKpBP qb8ZRpoEkpS1oE29wWFlSF3XRb9YRXZDMxZ0H4+A3VZC0sU7S/tWbWtMyxRRDS3jJMHI YgE7RRdBUB2CpPOlNYeWiFV/gCZFJjubMOWW1RHgg/bNxQtLx7fiZX0bHmfLMcFEYG3N R9py5aNxc0s4EuRMgVZ5D//mlNCE/yvVdoRDK0bjPhjxKyuYRAFJxynG1PvluDl9nkSA KMaz6XD8RXsaE9Gf6BlyNJI4MwYGz0LNWLrJc3oSFGi0SkVlgtbvbMNqqNEcrJtYB1P3 OGIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=nciNlSmRjkL2N9Zp9t65K6n3+ndoM89KysRunZ8weo8=; b=s0tRVbm36khQw4h+gwomiLTKpwe5Ge/BG9zgnaaQRQk9HYdWH04UskF+1PFIRaYvT4 oDPHOP0yq5u6mf719lX8YJvsUWZgvfsum55It3Z2icbpstOsxmn8UK9NqfzchbFZZwpP LXkcRwZItsYejMyaclWpWMbljuuOI1YzyHg18kVL30wE9UxBQMJbjb4y1qFY6F87r5UL B0/wqsNbN32KWQXFwlZfsztKrHlDhXqs5Z5Y53Q1a4sZVs7zVf5db3pxE3N65F3GgoSQ s8ielnIuicZwv0+TaZIaYC3G31n9GooKVqCZx3Zgrt6kxcLtFDLBxqfZ/vtSSP+G/mKA N9wg== X-Gm-Message-State: APjAAAVmdni0jPTE4vZw1QO7zVOQmMY6PXUUAOpdgBCye7iWCteDTuxa JWq4/B65SbPnSezncMlZ/ps= X-Google-Smtp-Source: APXvYqwR8yF6GsCSXWV7iQLOiZsCRVawP4hk97yFiVfRwoXCYIpB4QA5cc8OU4fE7St0QvQV7yF/Dw== X-Received: by 2002:aa7:8c03:: with SMTP id c3mr20042633pfd.139.1567196614216; Fri, 30 Aug 2019 13:23:34 -0700 (PDT) Received: from [10.106.131.0] ([155.100.47.0]) by smtp.gmail.com with ESMTPSA id e19sm8254396pfh.114.2019.08.30.13.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Aug 2019 13:23:33 -0700 (PDT) From: Rob Sargent Message-Id: <4E2CEFF7-7FBF-43B2-A407-5B7A67BCA4AB@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_0ABBDBE1-D322-4400-BE13-02B5AE9362B3" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Returning a table from a function, that requires multiple selects? Date: Fri, 30 Aug 2019 14:23:32 -0600 In-Reply-To: Cc: stan , "pgsql-general@lists.postgresql.org" To: Guyren Howe References: <20190830200315.GA28175@panix.com> X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_0ABBDBE1-D322-4400-BE13-02B5AE9362B3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 30, 2019, at 2:09 PM, Guyren Howe wrote: >=20 > On Aug 30, 2019, at 13:03 , stan > wrote: >=20 >> I need to encapsulate, what are basically 2 related function calls = into a single >> function. The result of each of th calls is a date type. >>=20 >> y current thinking is to return a 2 row table with the 2 dates in it. = But, I seem to >> be having issues getting this to work. >>=20 >> Is it possible for a function to return a table with results from = multiple >> queries? >=20 > You could just return a tuple VALUES(a, b). Or you could define a type = to return if you want to get fancy. Here I you might want VALUE(array[=E2=80=98heading1=E2=80=99,a], = array[=E2=80=98heading2',b]) unless you=E2=80=99re certain you know = which date is which.= --Apple-Mail=_0ABBDBE1-D322-4400-BE13-02B5AE9362B3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Aug 30, 2019, at 2:09 PM, Guyren Howe <guyren@gmail.com> = wrote:

On Aug 30, = 2019, at 13:03 , stan <stanb@panix.com> = wrote:

I need to encapsulate, what are basically 2 = related function calls into a single
function. The result = of each of th calls is a date type.

y = current thinking is to return a 2 row table with the 2 dates in it. But, = I seem to
be having issues getting this to work.

Is it possible for a function to return a = table with results from multiple
queries?

You could just return a tuple VALUES(a, b). Or you could = define a type to return if you want to get fancy.3D""
Here I you might want = VALUE(array[=E2=80=98heading1=E2=80=99,a], array[=E2=80=98heading2',b]) = unless you=E2=80=99re certain you know which date is = which.= --Apple-Mail=_0ABBDBE1-D322-4400-BE13-02B5AE9362B3--