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 1i3nLC-0001yU-HE for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2019 20:17:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i3nLA-0005Gv-1F for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2019 20:17:48 +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 1i3nL9-0005Go-M5 for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2019 20:17:47 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3nL6-0007w4-BX for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2019 20:17:47 +0000 Received: by mail-pf1-x433.google.com with SMTP id b24so5353051pfp.1 for ; Fri, 30 Aug 2019 13:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=V12Xz9CjCbx2RJL+Pqsi4vlOIVzB6fYjqeXxQ2Utlu8=; b=m+3jq8jyJjlPzlEmG4clrSnO5PeannfT9UfxgRajnxIrx3J/2M/9vm1DRJ8canTqUQ 6MIkbisU3GY5rQZoxvT4yCE+l66eOxYUk0wG0RBiiOYRhsBwYbRaYuEHUk9We5xp97R6 /YNuoOSQ5mYQgbP/W709jCxIOKMjkivrVYZJ2qPxrU3tB1xyBjbNe5i0H2d5KdvstRxt P/OhmBfbEgqflKQ0Fq/q1Q0Zia35mOSlPRfc0/D/4v7Rzo8P6Lpqwyno7XEOxUHbIe/F ZldlUG+QnRw9w4IzfiWwH3gFqxLYqckiEAKJuqBhLlC7/Ort0wVjoC17yA/wwuUWjX2p pJcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=V12Xz9CjCbx2RJL+Pqsi4vlOIVzB6fYjqeXxQ2Utlu8=; b=CZLUYYj+2kvpMdcm6izO63OkmMLLvXaAaaCxqU3XIvUVty6nkiORXUcJc7SslYlZDo 0+StuZYKAvwWirGeo6dTikjW38FrucRhl2sIsKp0n2swVDMqVvYto1HtAufr/yUXS7Zh UnTbz3zKtA/V5UoGGcoSFP0zh6IlHGwQnidMu/CXPm32vbWW1t/7+uw3kNNxpeRVXLnA PZXB6I+s2GiRUYr/VdwLuwyyAxgsbIdouFpxC5i/4Q9fpcYG1qIKSlsCuXlRCK+u7PgU 5MEuOtNJba+VOeghjyxBcN/jzwpxw8d8h9N91PtjNFvJ18x0MNT7xigIZ0K++9Qes3Pu mcgQ== X-Gm-Message-State: APjAAAXPSzp9USj46niTxCJmGsH6KYt9BzfOo1Q9RZeSM6YAJYY83erN ryDk2MhzrEVxDaCRAVxX7+Y= X-Google-Smtp-Source: APXvYqzv4jFmx+peBiq6VZPHowRQDCE5zULAEggb9K0zGw3s5EdA2RWrwX6qEw0Ublja8RyFAkN4Uw== X-Received: by 2002:a17:90a:1b62:: with SMTP id q89mr337947pjq.80.1567195816201; Fri, 30 Aug 2019 13:10:16 -0700 (PDT) Received: from ?IPv6:2600:8801:8800:20::8? ([2600:8801:8800:20::8]) by smtp.gmail.com with ESMTPSA id y68sm14690076pfy.25.2019.08.30.13.10.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Aug 2019 13:10:15 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_D34729CD-45C3-415E-AEB9-D2B91C6549B0" 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? From: Guyren Howe In-Reply-To: <20190830200315.GA28175@panix.com> Date: Fri, 30 Aug 2019 13:09:30 -0700 Cc: "pgsql-general@lists.postgresql.org" X-Mailbutler-Message-Id: 6698E81D-56D2-460C-88E1-29928B4845B3 Message-Id: References: <20190830200315.GA28175@panix.com> To: stan X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_D34729CD-45C3-415E-AEB9-D2B91C6549B0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Aug 30, 2019, at 13:03 , stan 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. >=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? You could just return a tuple VALUES(a, b). Or you could define a type = to return if you want to get fancy.= --Apple-Mail=_D34729CD-45C3-415E-AEB9-D2B91C6549B0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 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""= --Apple-Mail=_D34729CD-45C3-415E-AEB9-D2B91C6549B0--