Re: Issue with st_estimatedextent function ??

Paul Ramsey via postgis-users <[email protected]> Wed, 19 Nov 2025 10:36:00 -0800
Newsgroups gmane.comp.gis.postgis
Message-ID <CACowWR3eu0KdVWqrZh+=JMUSg7J4GqzN-BSFcXoSQF2hw0VTkA@mail.gmail.com>
--000000000000bfe8970643f6da80
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I cannot replicate this bug on my PostGIS 3.5.5dev environment, probably
because the issue is already fixed as of 3.5.3

https://github.com/postgis/postgis/blob/stable-3.5/NEWS#L66
https://trac.osgeo.org/postgis/ticket/5819

I think you probably need a maintenance upgrade.

ATB,
P

On Wed, Nov 19, 2025 at 9:21=E2=80=AFAM Bo Victor Thomsen <
[email protected]> wrote:

> Hi list -
>
> I'm using Postgres/Postgis as a data repository for QGIS - and it normall=
y
> just works.. However I'm getting errors with tables having long names, fo=
r
> example:
>
>
> * fdc_results.bygningskade_stormflod_rcp85_2100_t100_ssp3_7_0_20251119164
> *
> (Schema-name length: 11, table-name length: 59)
>
> I have tracked the issue using the log facility in QGIS. It shows, that
> QGIS intermittently executes a SQL command:
>
> *SELECT
> st_estimatedextent('fdc_results','bygningskade_stormflod_rcp85_2100_t100_=
ssp3_7_0_20251119164','geom')*
>
> which results in an error: *ERROR: invalid name syntax*
>
> If I change the table name to:
>
> *fdc_results.bygningskade_stormflod_rcp85_2100_t100_ssp3_7_0   *(Schema-n=
ame
> length: 11, table-name length: 47)
>
> the error disappears.
>
> I've done some testing and could replicate the error (and non-error)
> situation in PGAdmin
>
> Further testing shows that if the sum of the character lengths of the
> schema- and table-name is larger than 58 the function will stop with an
> error. Otherwise it returns a result like:
>
> "BOX(716701.25 6167151,720533.9375 6174220)"
>
> It's my understanding, that the maximum length of a tablename in
> PostgreSQL is 63. This same limit applies for every type of identifier in
> Postgres. Am I wrong to assume this? Or is there an issue with name lengt=
hs
> in the PostGIS st_estimatedextent  function??
>
> (It might be a coincidence but if you express the tablename like this :
> *"**fdc_results"."bygningskade_stormflod_rcp85_2100_t100_ssp3_7_0**", *th=
e
> total length is 63)
>
> PostgreSQL version: "PostgreSQL 17.4 on x86_64-windows, compiled by
> msvc-19.42.34436, 64-bit"
>
> PostGIS version: "3.5 USE_GEOS=3D1 USE_PROJ=3D1 USE_STATS=3D1"
>
> --
> Med venlig hilsen / Best regards
>
> Bo Victor Thomsen
>
>

--000000000000bfe8970643f6da80
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I cannot replicate this bug on my PostGIS 3.5.5dev environ=
ment, probably because the issue is already fixed as of 3.5.3<div><br></div=
><div><a href=3D"https://github.com/postgis/postgis/blob/stable-3.5/NEWS#L6=
6">https://github.com/postgis/postgis/blob/stable-3.5/NEWS#L66</a></div><di=
v><a href=3D"https://trac.osgeo.org/postgis/ticket/5819">https://trac.osgeo=
.org/postgis/ticket/5819</a><br></div><div><br></div><div>I think you proba=
bly need a maintenance upgrade.</div><div><br></div><div>ATB,</div><div>P</=
div></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"=
ltr" class=3D"gmail_attr">On Wed, Nov 19, 2025 at 9:21=E2=80=AFAM Bo Victor=
 Thomsen &lt;<a href=3D"mailto:[email protected]">bo.victor.thoms=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid=
;border-left-color:rgb(204,204,204);padding-left:1ex"><u></u>

 =20

   =20
 =20
  <div>
    <p>Hi list -=C2=A0</p>
    <p>I&#39;m using Postgres/Postgis as a data repository for QGIS - and i=
t
      normally just works.. However I&#39;m getting errors with tables
      having long names, for example:=C2=A0<br>
      <i><b><br>
fdc_results.bygningskade_stormflod_rcp85_2100_t100_ssp3_7_0_20251119164=C2=
=A0<br>
        </b></i><br>
      (Schema-name length: 11, table-name length: 59)</p>
    <p>I have tracked the issue using the log facility in QGIS. It
      shows, that QGIS intermittently executes a SQL command:=C2=A0</p>
    <p><i><b>SELECT
st_estimatedextent(&#39;fdc_results&#39;,&#39;bygningskade_stormflod_rcp85_=
2100_t100_ssp3_7_0_20251119164&#39;,&#39;geom&#39;)</b></i></p>
    <p>which results in an error:=C2=A0<b><span style=3D"color:rgb(34,34,34=
);font-family:&quot;Source Code Pro&quot;,SFMono-Regular,Menlo,Monaco,Conso=
las,&quot;Liberation Mono&quot;,&quot;Courier New&quot;,monospace;font-size=
:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:nor=
mal;letter-spacing:0.14994px;text-align:start;text-indent:0px;text-transfor=
m:none;word-spacing:0px;white-space:pre-wrap;background-color:rgb(255,255,2=
55);text-decoration-style:initial;text-decoration-color:initial;float:none;=
display:inline">ERROR:  invalid name syntax</span></b></p>
    <p>If I change the table name to:</p>
    <p><i><b>fdc_results.bygningskade_stormflod_rcp85_2100_t100_ssp3_7_0=C2=
=A0
          =C2=A0</b></i>(Schema-name length: 11, table-name length: 47)=C2=
=A0</p>
    <p>the error disappears.=C2=A0</p>
    <p>I&#39;ve done some testing and could replicate the error (and
      non-error) situation in PGAdmin</p>
    <p>Further testing shows that if the sum of the character lengths of
      the schema- and table-name is larger than 58 the function will
      stop with an error. Otherwise it returns a result like:</p>
    <p>&quot;BOX(716701.25 6167151,720533.9375 6174220)&quot;</p>
    <p>It&#39;s my understanding, that the maximum length of a tablename in
      PostgreSQL is 63. This same limit applies for every type of
      identifier in Postgres. Am I wrong to assume this? Or is there an
      issue with name lengths in the=C2=A0<i><b></b></i>PostGIS=C2=A0st_est=
imatedextent<i><b>
        </b></i>=C2=A0function??=C2=A0</p>
    <p>(It might be a coincidence but if you express the tablename like
      this :=C2=A0<i><b>&quot;</b></i><i><b>fdc_results&quot;.&quot;bygning=
skade_stormflod_rcp85_2100_t100_ssp3_7_0</b></i><i><b>&quot;,=C2=A0</b></i>=
the
      total length is 63)=C2=A0</p>
    <p>PostgreSQL version: &quot;PostgreSQL 17.4 on x86_64-windows, compile=
d
      by msvc-19.42.34436, 64-bit&quot;</p>
    <p>PostGIS version: &quot;3.5 USE_GEOS=3D1 USE_PROJ=3D1 USE_STATS=3D1&q=
uot;</p>
    <pre cols=3D"72">--=20
Med venlig hilsen / Best regards

Bo Victor Thomsen</pre>
  </div>

</blockquote></div>

--000000000000bfe8970643f6da80--