Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0vkk-0001BB-4x for pgsql-general@arkaria.postgresql.org; Fri, 14 Sep 2018 21:35: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 1g0vki-0004TQ-Lg for pgsql-general@arkaria.postgresql.org; Fri, 14 Sep 2018 21:35:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0vki-0004TD-AN for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 21:35:48 +0000 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g0vkf-0005Kj-V9 for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 21:35:47 +0000 Received: by mail-io1-xd2a.google.com with SMTP id q5-v6so7178744iop.3 for ; Fri, 14 Sep 2018 14:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:mail-followup-to:date:message-id:user-agent :organization:mime-version; bh=KXsEj44t33SgsM6995G3OXFq3+451WQrikR9lCFXj3o=; b=Lo/rDgACBIWlFAkV0YR9V1GgwK1i0zL7xDXibf5XB7ujKkotx5NYC/+om7LA31+9rp NNvmzZhne8t0fJtPWPf5+AZNIhDAti8SXh1pi8UWtQ50YaCUzil0zpbFVih8XjUxYZfl 8Wsym5m5q3WUCt7hMmGNiefaqHA09vY9PqRQdkXG5hDcZYT30MlG/j9cfp8X13PoKvJp NM0kvMQv/7v9Tur56jr0GeFz3Rbbop1VexG0A1piWYwswCY2wOPfSnv036Hlj8qDoR5K 0jNSBgOobT4IFhLv+bKUXSpM8liYf2a1rQl8nZ4ZThWMEEiaqzeeaCxRCyH+x4dbPH4j aJ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:mail-followup-to:date:message-id :user-agent:organization:mime-version; bh=KXsEj44t33SgsM6995G3OXFq3+451WQrikR9lCFXj3o=; b=qpBg/jVx69QS8/0i1tJ0iWlisDIi5CbEn7aBbyeEXwwZpXatNAV5CYAHmWt4/3Krmm eFHXBN95RaTgigwHuqrHMOmhzVEvZt0hksC37poAnT6WYWFO9ovGj244jkcIcrsgYXXs j4G8eLMJjMQgcudQnJE5GUb/me1GgLTuSdTAd3F4Ef1ziLtfaCYGA1AqpGLwLOUWGcTZ gPyp1TIDSOVy+1SPCoZhyfVogYIiTNY2EJQcM60Qcl00HmgjBcXJSzjYhR48OsFwVb35 9Uw3Ch2O6fiY6nyodU4J09vv4kAYpTNENsh37zVz5p1QFywFMUTBOSNi1i2QzEfQtcvk o3gw== X-Gm-Message-State: APzg51CeOccM2jtCpUdfc4uxGboQiCoqX6IiXRn0XylexAcFlolw00Gx qgx64RpNDYb50B99CUKHkFDHuNRi X-Google-Smtp-Source: ANB0VdZGdj32nH9JPUWFBwO6X9M2XbOw5Kn4L3l/lwZfqfMzX49RkIM2BPZzvtwaE8m+QYKQ0XsEWw== X-Received: by 2002:a6b:b242:: with SMTP id b63-v6mr11941910iof.172.1536960945022; Fri, 14 Sep 2018 14:35:45 -0700 (PDT) Received: from smtp.gmail.com (net82.ceos.umanitoba.ca. [130.179.67.82]) by smtp.gmail.com with ESMTPSA id t134-v6sm39493itb.41.2018.09.14.14.35.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Sep 2018 14:35:44 -0700 (PDT) From: "Sebastian P. Luque" To: pgsql-general@lists.postgresql.org Subject: column information from view Mail-Followup-To: pgsql-general@lists.postgresql.org Date: Fri, 14 Sep 2018 16:35:42 -0500 Message-ID: <87in373gpd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Organization: University of Manitoba MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I'm trying to generate a table with information on columns from a temporary view that simply selects a subset of columns from a persistent view in a given schema. The persistent view joins a number of tables with columns that may or may not have a description entered. I need a table with a list of columns from the temporary view, and the matching descriptions from the underlying persistent view. Here's my attempt at listing the temporary view's columns and respective descriptions: SELECT cols.ordinal_position, cols.column_name, col_description(cl.oid, cols.ordinal_position::INT) FROM pg_class cl, information_schema.columns cols WHERE cols.table_catalog='dbname' AND cols.table_schema='some_schema' AND cols.table_name = 'persistent_view' AND cols.table_name = cl.relname ORDER BY cols.ordinal_position::INT; The problem, of course, is that it lists columns from the persistent view, instead of the subset of them in the temporary view. Is there a better way to do that? Hopefully this makes sense. Thanks, -- Seb