Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bi1dO-0004i8-Ux for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Sep 2016 15:53:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bi1dO-000254-H0 for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Sep 2016 15:53:02 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bi1dO-00024w-2V for pgsql-bugs@postgresql.org; Thu, 08 Sep 2016 15:53:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bi1dL-0005HI-AV for pgsql-bugs@postgresql.org; Thu, 08 Sep 2016 15:53:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u88FqvHE004558; Thu, 8 Sep 2016 11:52:57 -0400 From: Tom Lane To: lucian.ciufudean@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14317: psql \dt not working as expected In-reply-to: <20160908154003.1410.72854@wrigleys.postgresql.org> References: <20160908154003.1410.72854@wrigleys.postgresql.org> Comments: In-reply-to lucian.ciufudean@gmail.com message dated "Thu, 08 Sep 2016 15:40:03 -0000" Date: Thu, 08 Sep 2016 11:52:57 -0400 Message-ID: <4557.1473349977@sss.pgh.pa.us> X-Pg-Spam-Score: -3.0 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org lucian.ciufudean@gmail.com writes: > If one creates a table with the same name as one of the pg_catalog tables > then \dt will not show it: This is expected, if you are using the default search_path, because pg_catalog will be in front of public and will mask your version of pg_tables. > Expectations: \dt shows all tables in the public schema. Nope, \dt shows *visible* tables, ie those that can be referenced without schema qualification. See this bit in the psql documentation: Whenever the pattern parameter is omitted completely, the \d commands display all objects that are visible in the current schema search path — this is equivalent to using * as the pattern. (An object is said to be visible if its containing schema is in the search path and no object of the same kind and name appears earlier in the search path. This is equivalent to the statement that the object can be referenced by name without explicit schema qualification.) To see all objects in the database regardless of visibility, use *.* as the pattern. > Note that it is also unexpected that this query: > select * from pg_tables; > goes to pg_catalog.pg_tables instead of public.pg_tables. Again, you are confused about how the search path works. If you really want to, you can put public in front of pg_catalog in your search path, but it's not recommendable --- it's a security hazard, for one thing. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs