Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m58BR-0004ET-5x for pgsql-admin@arkaria.postgresql.org; Sun, 18 Jul 2021 14:54:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m58BP-0007gN-SM for pgsql-admin@arkaria.postgresql.org; Sun, 18 Jul 2021 14:54:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m58BP-0007gF-Ib for pgsql-admin@lists.postgresql.org; Sun, 18 Jul 2021 14:54:19 +0000 Received: from mout.gmx.net ([212.227.15.15]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m58BJ-0000EC-37 for pgsql-admin@lists.postgresql.org; Sun, 18 Jul 2021 14:54:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1626620049; bh=0sOA6pESIO2w0xmlT7/lBfMYqANziArswBkUenVq7tk=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=TT2bBfC8blzzsV4YpW6Ts3fs99558LSl+jyc+D4KAHtDwmoLZpmKxT3AqHmuUUxvC h/Qxo/NM02sMsQKK4nRKQwPfyQmHF6h051oodtEsqoQnJPx+3Y1BhebJipn/aEmxaw IkQm8cRfcMtrTQnf2A9DKKTHKJdK66cPAOKVqKP4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.20] ([83.171.160.172]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MZCfD-1laam00Onp-00VCUm for ; Sun, 18 Jul 2021 16:54:09 +0200 Subject: Re: Need query To: pgsql-admin@lists.postgresql.org References: From: Thomas Kellerer Message-ID: Date: Sun, 18 Jul 2021 16:54:08 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:G/QKFRdohTOjx9/OFi1ka7opXpxdyMyT+Sm2ynLLC94ARwtm2wl vewf9dQgZDt07ZB40JI8MuUspCiYElMhXhf8drFroPiVQ5YyqwJJETJ+M9QfzO88tKh9eBy 8ctpgSPq6P884xNS6AcAS+ibsEPutco+Hkrr1nilp57amteHBn6RrVjCJFKmaSoxvQ/LIlK xnz5qodJCgBUz1BQzDu7Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:KgRIluDKg/Q=:i2Wyt59JBw/T4Uvsczp+Mc ndX7qrJZdbnaMOyttDw178OBV24CFD4JaLFqzgFQxU2+14j2qoy/A52/FdQSPj7B7NU75Bprt twGDtmq6raFCF2Kifrrund1zHylKcCehh99xS6jVcjfvVVdEuddFWIB24evtba0bNPqdXnm06 8CMN+Z1N+rlQ3g9XbpZtXC2SqkuCOP4RpmjGc9yFKHi8eJh6Ywf5IunAMMvS0gOYMlWHeGoGt tnCUTPjR4rcJd8PiO6PFEfuHcId/48hWNpKo4IkfW7sx5ZQk+nidUiCnZbX5SMN+ZXQ3IQzlE BYaQ1eI3UuxlgRVfAPLTc6Nr3yN+4jA/cKWxpLrE9WXhJOXF41a9Kvf4uxFeTZvfUuvTbC7J9 Fsi4y3wKQr4ocxwnI5zh+Ljvc0aSB5DqOU5CVXX/coNolO2znrHWWadsfi2fIt1NNJdGKZl6d ezMHkQtfBIUk3uTEpW1PGhD6743jHFcrW7WA/wLytXHEvglJaxPtehsx43XPoWRe3TwwWrJkO iaA9IaNzs5AQz9aTPq9Sz6mzCw5IYEflMBozEtFbmhr2FnaE0gidfh+nUn3rgbTL6p7tfI/jy ACjnG0UjB2YNTWekCC1iJo5pb6ie9uuwA+Cip1xbjfS0lhm2su0ilEtFNQaMEst/gCCRasooD 8bMZVdV4SZz+zKtkC8JeMby6R+oo042EE0YTdjVTpt7fg21XZkxJbwUJIFZeEDJ/mnzHsiXSi t0zUofvOlJ9irCU5Q363dekRCfiCxk9EKuAXX6l2bW6xHrC32ccIDD19bbIT3QaCrIObi1GFE OoW9OVwaj7/XqbLeuxB39gDobbOIm0k0qXPkG8p10AR1EsYu22UZoxEe5l/gM9GxfNolQ0H9X zw0b2YcEYqVnD+o0iWTDvMX5tw7pW3w17BJBFJK/EeHvD0h/7AbhP6omTv3ld5XgKlpudzSAd y9OKpJ8eunjCWlke1Lv0UxXqlAfvLnG0n5ZCSBNPvQ00Wwql0o2i53uUjr8V9zg8x8XSGILQP AgNrT/Q0/XVXsD++S5FkFkIgIoh651l2ntY9GFFynmPKAotK/ws6pTqrGS7ClGzssAjFwAZ1x 0F8FHow1YEOEviOfsFLxDc8Cb91VjlQQhS5 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Caetano Traina Junior schrieb am 18.07.2021 um 15:19:> >> Em s=C3=A1b., 17 de jul. de 2021 =C3=A0s 05:33, Thomas Kellerer > escreveu: >> And before you ask: it's not really possible to make this dynamic, = so that the number >> of columns "automagically" increases when you have more fruits. One= fundamental >> restriction of the SQL language is that the number and types of all= columns >> must be known to the database when the query is parsed. It can't ch= ange >> the columns as a result of the query itself. > Nonetheless, it is always possible to write a dynamic SQL (and best > yet, inside a plpgsql function) to "automagically handle more > fruits..." Even if you create a function that uses dynamic SQL, you still have to specify each output column "manually" when calling the function. So that doesn't really buy you anything.