Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAPSB-00FZXC-NR for pgsql-general@arkaria.postgresql.org; Mon, 11 Nov 2024 08:07:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tAPS8-00CMCb-Qd for pgsql-general@arkaria.postgresql.org; Mon, 11 Nov 2024 08:07:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAPS8-00CMCT-Fw for pgsql-general@lists.postgresql.org; Mon, 11 Nov 2024 08:07:17 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tAPS6-001GPK-CX for pgsql-general@postgresql.org; Mon, 11 Nov 2024 08:07:15 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2fb4af0b6beso53448811fa.3 for ; Mon, 11 Nov 2024 00:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731312430; x=1731917230; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=RvJ4XhvnOSJ901OM8kRxqguY4PYV/Oz70hFR5RMQtA0=; b=lwXNU14WixxxdMSa/5uxVM2RYA8TxZpVSxf+VanbU8R4PTEXOAGb9epw3uEvmhg7oJ rTwnZbFxOmbDgaTdb3FcI6/HtPWwQadd4e64hV2O6SlGQ3zpYnr0l78ZNS8GiDBUlZVv AWkOBF10fuHH6JQDvtuiVUZve7JgVcm/D6zykI8ziuRUAFkLNJrxyeIMrest7B8nlZiU nsP1CjvhdK/rQMNIlg9qM3zUUYATRm1pyKZE7bE6V/nAEAX4K1KOZGX4JGIXCH5jqXEw 3mughIzFhS9mnQp77aC3E7UwX6jxFLX8DyPwFNmbYpjF/zH/Ptrxd1t0nDcZU9I7ytCS u6sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731312430; x=1731917230; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RvJ4XhvnOSJ901OM8kRxqguY4PYV/Oz70hFR5RMQtA0=; b=u9oM02HC5G6CFKMBddkEvMMBmlvdGdWtsh4aMN8VOzuax4F1QkrXWjkz4FCAibfjnR bpkJauL8KJTvwNNIBiQHYjkvtGDiJE4iWOTbAoQbbqDq9BcjY6gzmRWFf77QRbRZ3SAx JrMMX3dv5GUaPhF9RwosKhjdGcynPg3az2u5gsrLLpkMc190Vl1YgvxSyG2q4AZivTS+ yshQjCerfNnaJRLu+e1sBvmrGp5W4Pv4pXH1VqwXQyYTZbMcQK+cg6r026xVmoA8BUtJ krdSuTOoVmr+kC+Bd/We5wtJ6ZRcAaXQ3sTFlbaT7KovXkMgbtMWKPiA9r9c7G9+9+mo Wlug== X-Gm-Message-State: AOJu0Ywrm+Y/1kRznClRZ5w/X25uPYj05HGDAY9fXVoyGE2q0ZCue12G QWLDMfy67HkdvKnVQt4pXDkY9m4Rmdmx1xyeNv/dvVQEuGuMevGwhbsNKTlP018YPd193pd0ZuQ jJCgmlNeE0rcc/HJiprgz1r7YAiYyuzC2v8E= X-Google-Smtp-Source: AGHT+IFU2JiHcUWHoUCgxmW1gtPcMZMDsTELkQrD3iwUe1sviD6+qsXcYQRqg4b27p6x4f0YirdWvwsH3zZg+beaSow= X-Received: by 2002:a05:651c:b20:b0:2f7:7be8:fd89 with SMTP id 38308e7fff4ca-2ff2016262fmr72877421fa.6.1731312429380; Mon, 11 Nov 2024 00:07:09 -0800 (PST) MIME-Version: 1.0 From: Kirill Reshke Date: Mon, 11 Nov 2024 13:06:57 +0500 Message-ID: Subject: CREATE SCHEMA ... CREATE M.V. support To: pgsql-general@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi! I was exploring the PostgreSQL parser and discovered a very interesting feature. Users can create schema along with schema objects in single SQL. So, for example ``` db1=# create schema shshshsh create table t1(i int) create view v1 as select * from t1; CREATE SCHEMA ``` works. But `create schema shshshsh create materialized view v1 as select ` will not work. I was trying to search for relevant discussions, but failed. It appears that the feature has been available from 7.3 versions[1]. Support for materialized views began in 9.3. Perhaps, then, this is simply something that was overlooked for support? It appears that supporting this is as simple as changing this parser's non-terminal [2]. However, perhaps there are justifications for why we forbid this? P.S. is this the correct place to make this question? [1] https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/parser/gram.y?h=REL7_3_STABLE#n802 [2] https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/parser/gram.y?h=14e87ffa5c543b5f30ead7413084c25f7735039f#n1580 -- Best regards, Kirill Reshke