pgstattuple does not work with uppercase table names

Started by Andreas Erikssonover 7 years ago4 messagesbugs
Jump to latest
#1Andreas Eriksson
andreas.eriksson@griffeye.com

Steps to reproduce:
CREATE EXTENSION pgstattuple;
CREATE TABLE "Test" AS SELECT * FROM generate_series(1, 10000);
SELECT * FROM pgstattuple('Test');

ERROR: relation "test" does not exist SQL state: 42P01

/Andreas

Andreas Eriksson
Principal Software Engineer, Software Architect
Tel: +46 31 719 08 00
Mobile: +46 739 07 41 79
andreas.eriksson@griffeye.com

[Griffeye]

Griffeye Technologies AB
F?rsta L?nggatan 30, SE-413 27 G?teborg, Sweden
griffeye.com<https://www.griffeye.com&gt;

a Safer Society Group company

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
To preserve the environment, print this message only if necessary

#2Magnus Hagander
magnus@hagander.net
In reply to: Andreas Eriksson (#1)
Re: pgstattuple does not work with uppercase table names

On Fri, Nov 2, 2018 at 11:51 AM Andreas Eriksson <
andreas.eriksson@griffeye.com> wrote:

Steps to reproduce:

CREATE EXTENSION pgstattuple;

CREATE TABLE "Test" AS SELECT * FROM generate_series(1, 10000);

SELECT * FROM pgstattuple('Test');

ERROR: relation "test" does not exist SQL state: 42P01

You need to quote the identifier:
SELECT * FROM pgstattuple('"Test"');

Note the double quotes inside the string, so
"singlequote-doublequote-Test-doublequote-singlequote".

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#3Andreas Eriksson
andreas.eriksson@griffeye.com
In reply to: Magnus Hagander (#2)
RE: pgstattuple does not work with uppercase table names

Thanks,

Could it be helpful to explain this in the user manual?

/Andreas

From: Magnus Hagander <magnus@hagander.net>
Sent: den 2 november 2018 11:55
To: Andreas Eriksson <andreas.eriksson@griffeye.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: pgstattuple does not work with uppercase table names

On Fri, Nov 2, 2018 at 11:51 AM Andreas Eriksson <andreas.eriksson@griffeye.com<mailto:andreas.eriksson@griffeye.com>> wrote:
Steps to reproduce:
CREATE EXTENSION pgstattuple;
CREATE TABLE "Test" AS SELECT * FROM generate_series(1, 10000);
SELECT * FROM pgstattuple('Test');

ERROR: relation "test" does not exist SQL state: 42P01

You need to quote the identifier:
SELECT * FROM pgstattuple('"Test"');

Note the double quotes inside the string, so "singlequote-doublequote-Test-doublequote-singlequote".

--
Magnus Hagander
Me: https://www.hagander.net/&lt;http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/&lt;http://www.redpill-linpro.com/&gt;

Andreas Eriksson
Principal Software Engineer, Software Architect
Tel: +46 31 719 08 00
Mobile: +46 739 07 41 79
andreas.eriksson@griffeye.com

[Griffeye]

Griffeye Technologies AB
Första Långgatan 30, SE-413 27 Göteborg, Sweden
griffeye.com<https://www.griffeye.com&gt;

a Safer Society Group company

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
To preserve the environment, print this message only if necessary

#4Magnus Hagander
magnus@hagander.net
In reply to: Andreas Eriksson (#3)
Re: pgstattuple does not work with uppercase table names

On Fri, Nov 2, 2018 at 11:56 AM Andreas Eriksson <
andreas.eriksson@griffeye.com> wrote:

Thanks,

Could it be helpful to explain this in the user manual?

(please avoid top-posting)

It's documented at
https://www.postgresql.org/docs/11/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS,
as it's a pretty fundamental part of SQL. We definitely could move it to a
more prominent place, but it would make little sense to document it
individually for every place that uses one I think.

//Magnus

Show quoted text

*From:* Magnus Hagander <magnus@hagander.net>
*Sent:* den 2 november 2018 11:55
*To:* Andreas Eriksson <andreas.eriksson@griffeye.com>
*Cc:* pgsql-bugs <pgsql-bugs@postgresql.org>
*Subject:* Re: pgstattuple does not work with uppercase table names

On Fri, Nov 2, 2018 at 11:51 AM Andreas Eriksson <
andreas.eriksson@griffeye.com> wrote:

Steps to reproduce:

CREATE EXTENSION pgstattuple;

CREATE TABLE "Test" AS SELECT * FROM generate_series(1, 10000);

SELECT * FROM pgstattuple('Test');

ERROR: relation "test" does not exist SQL state: 42P01

You need to quote the identifier:

SELECT * FROM pgstattuple('"Test"');

Note the double quotes inside the string, so
"singlequote-doublequote-Test-doublequote-singlequote".

--

Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

*Andreas Eriksson *Principal Software Engineer, Software Architect
Tel: +46 31 719 08 00
Mobile: +46 739 07 41 79
andreas.eriksson@griffeye.com

[image: Griffeye]

*Griffeye Technologies AB *Första Långgatan 30, SE-413 27 Göteborg, Sweden
griffeye.com <https://www.griffeye.com&gt;