Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-15 Thread Laurenz Albe
Well, it is simple. As we wrote, some of us think that cursors are useful, and we tried to explain why we think that. If you don't think that cursors are useful, don't use them. We are not out to convince you otherwise. Yours, Laurenz Albe

Re: "No Free extents", table using all allocated space but no rows!

2023-03-15 Thread Laurenz Albe
On Thu, 2023-03-16 at 01:58 +, Dolan, Sean wrote: > Environment: PostGres 13 on RedHat 7.9.   >   > I am using logical replication (publisher/subscriber) between two databases > and there > are times where one of our schemas gets to 100% of allocated space (No Free > Extents). > I went into

RE: uuid-ossp source or binaries for Windows

2023-03-15 Thread Mark Hill
Hey Daniel, Thanks for getting back to me. I think the issue I'm having is that my build of Postgres is missing uuid pieces needed by our users. They're executing the command: CREATE EXTENSION "uuid-ossp" and getting the error ERROR: could not open extension control file

"No Free extents", table using all allocated space but no rows!

2023-03-15 Thread Dolan, Sean
Environment: PostGres 13 on RedHat 7.9. I am using logical replication (publisher/subscriber) between two databases and there are times where one of our schemas gets to 100% of allocated space (No Free Extents). I went into the schema and did a \dt+ to see the amount of size being used and I

Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-15 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > > I have a hard time fathoming why someone who writes documentation does not > actually read documentation. Ouch. In fact, I had read the whole of the "43.7. Cursors" section in the "PL/pgSQL" chapter (www.postgresql.org/docs/15/plpgsql-cursors.html). And

Re: Help? Unexpected PostgreSQL compilation failure using generic compile script

2023-03-15 Thread Martin Goodson
On 13/03/2023 00:02, Adrian Klaver wrote: On 3/12/23 14:43, Martin Goodson wrote: Hello. For reasons I won't bore you with, we compile PostgreSQL from source rather than use the standard packages for some of our databases. So a fairly basic script that has been used for years suddenly

Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-15 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com wrote: >> >>> laurenz.a...@cybertec.at wrote: >>> >>> You seem to think that a client request corresponds to a single database >>> request >> >> …I can’t picture a concrete use case where, not withstanding the "where" >> restriction

Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-15 Thread Adrian Klaver
On 3/15/23 13:37, Bryn Llewellyn wrote: laurenz.a...@cybertec.at wrote: Re « You seem to think that a client request corresponds to a single database request », I meant no more than what psql models when you hit "return"after terminating an ordinary SQL statement with semi-colon (i.e. not a

Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-15 Thread Bryn Llewellyn
> laurenz.a...@cybertec.at wrote: > >> b...@yugabyte.com wrote: >> >> Section "43.7. Cursors” in the PL/pgSQL chapter of the doc >> (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) >> starts with this: >> >> « >> [...] >> A more interesting usage is to return

Re: uuid-ossp source or binaries for Windows

2023-03-15 Thread Daniel Gustafsson
> On 15 Mar 2023, at 19:31, Mark Hill wrote: > > I’ve downloaded the PostgreSQL 14.7 source and building it on Windows 64bit > and 32bit. > > I’m using the Visual Studio tools in the src/tools/msvc folder. > > I’m trying to build with the uuid extension but it looks like I need > uuid-ossp

Re: Table scan on 15.2

2023-03-15 Thread Arthur Ramsey
What's strange is that there is only 1 non-unique value in the column. >

uuid-ossp source or binaries for Windows

2023-03-15 Thread Mark Hill
I've downloaded the PostgreSQL 14.7 source and building it on Windows 64bit and 32bit. I'm using the Visual Studio tools in the src/tools/msvc folder. I'm trying to build with the uuid extension but it looks like I need uuid-ossp installed in order to get it to work. The source download

Numeric Division - Result Scale Calculation Oddity

2023-03-15 Thread David G. Johnston
Hey, v16 to get the nice underscore separators for readability. This came up on Reddit [1] the other day and boils down to the question: "why do the two divisions below end up with radically different result scales?" postgres=# select .999_999_999_999_999_999_999 / 2; ?column?

Re: Removing trailing zeros (decimal places) from a numeric (pre trim_scale()) with unexpected behaviour

2023-03-15 Thread Erik Wienhold
> On 15/03/2023 14:51 CET magog...@web.de wrote: > > I want to remove not needed decimal places / trailing zeros from a numeric. > I know this can be done starting PG >=13 with TRIM_SCALE(numeric) which would > solve my issue (with an additional CAST to TEXT at the end). Unfortunately > the

Re: Table scan on 15.2

2023-03-15 Thread Arthur Ramsey
That worked, thanks. I was trying to find how to do that in pgsql.

Re: Table scan on 15.2

2023-03-15 Thread Tom Lane
Arthur Ramsey writes: > After a restart and seq disabled for session with no other load (same for > plan with seq enabled). > Bitmap Heap Scan on t_user user0_ (cost=19567.17..58623.03 rows=800678 > width=761) (actual time=0.370..0.702 rows=36 loops=1) So the problem is that awful rowcount

Re: How to behive if I remove password from postgres role

2023-03-15 Thread Tom Lane
Raivo Rebane writes: > Then I altered role of postgres so, that password = NULL. > Now I am in situation that I can't run any postgres command. > What I must to do ? Stop the server, start it in single-user mode (postgres --single), issue an ALTER USER command to undo the damage. Or modify

Re: How to behive if I remove password from postgres role

2023-03-15 Thread Adrian Klaver
On 3/15/23 09:02, Raivo Rebane wrote: HI I wanted to install PostGIS Bundle so that it builds a sample spatial database, but got error - createdb: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  password authentication failed for user "postgres" Then I altered

Re: Table scan on 15.2

2023-03-15 Thread Arthur Ramsey
After a restart and seq disabled for session with no other load (same for plan with seq enabled). Bitmap Heap Scan on t_user user0_ (cost=19567.17..58623.03 rows=800678 width=761) (actual time=0.370..0.702 rows=36 loops=1) Recheck Cond: (upper((username)::text) = ANY ('{[redacted]'::text[]))

Re: Table scan on 15.2

2023-03-15 Thread Tom Lane
Arthur Ramsey writes: > I've upgraded from 12.11 to 15.2 and I'm seeing this query now use a > sequential scan which is taking 500ms instead of < 2ms. If I disable > sequential scans then it performs as well as 12.11. What does the EXPLAIN look like with seqscans disabled?

How to behive if I remove password from postgres role

2023-03-15 Thread Raivo Rebane
HI I wanted to install PostGIS Bundle so that it builds a sample spatial database, but got error - createdb: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "postgres" Then I altered role of postgres so, that password = NULL. Now

Re: Table scan on 15.2

2023-03-15 Thread Arthur Ramsey
Yes, I forgot to mention I did a REINDEX DATABASE and ANALYZE. On Wed, Mar 15, 2023 at 10:20 AM Adrian Klaver wrote: > On 3/15/23 08:17, Arthur Ramsey wrote: > > I've upgraded from 12.11 to 15.2 and I'm seeing this query now use a > > sequential scan which is taking 500ms instead of < 2ms. If

Re: pg_upgrade Only the install user can be defined in the new cluster

2023-03-15 Thread Dávid Suchan
It prints out: count --- 1 (1 row) Od: Daniel Gustafsson Odoslané: streda 15. marca 2023 13:27 Komu: Dávid Suchan Kópia: pgsql-gene...@postgresql.org Predmet: Re: pg_upgrade Only the install user can be defined in the new cluster > On 15 Mar 2023, at

Re: pg_upgrade Only the install user can be defined in the new cluster

2023-03-15 Thread Dávid Suchan
Can i create a brand new cluster and check it that way? Since I had to stop / shut down the 14 cluster in order to proceed with pg_upgrade and I dont know how can i connect to it now ... Od: Dávid Suchan Odoslané: streda 15. marca 2023 14:47 Komu: Daniel

Re: Table scan on 15.2

2023-03-15 Thread Adrian Klaver
On 3/15/23 08:17, Arthur Ramsey wrote: I've upgraded from 12.11 to 15.2 and I'm seeing this query now use a sequential scan which is taking 500ms instead of < 2ms.  If I disable sequential scans then it performs as well as 12.11. Did you run ANALYZE on the database/table in the new 15.2

Table scan on 15.2

2023-03-15 Thread Arthur Ramsey
I've upgraded from 12.11 to 15.2 and I'm seeing this query now use a sequential scan which is taking 500ms instead of < 2ms. If I disable sequential scans then it performs as well as 12.11. Schema: Table "public.t_user" Column |

Removing trailing zeros (decimal places) from a numeric (pre trim_scale()) with unexpected behaviour

2023-03-15 Thread magog002
Hi, I want to remove not needed decimal places / trailing zeros from a numeric. I know this can be done starting PG >=13 with TRIM_SCALE(numeric) which would solve my issue (with an additional CAST to TEXT at the end). Unfortunately the production database is still running with PostgreSQL 12.x

Re: pg_upgrade Only the install user can be defined in the new cluster

2023-03-15 Thread Daniel Gustafsson
> On 15 Mar 2023, at 14:48, Dávid Suchan wrote: > > Can i create a brand new cluster and check it that way? Since I had to stop / > shut down the 14 cluster in order to proceed with pg_upgrade and I dont know > how can i connect to it now ... Sure, create a new cluster in *same way* you will

Re: pg_upgrade Only the install user can be defined in the new cluster

2023-03-15 Thread Daniel Gustafsson
> On 15 Mar 2023, at 10:30, Dávid Suchan wrote: > ..there are no other users in the db. The check in question performs this: SELECT COUNT(*) FROM pg_catalog.pg_roles WHERE rolname !~ '^pg_'; What do you get when running that in the new v14 cluster? -- Daniel Gustafsson

pg_upgrade Only the install user can be defined in the new cluster

2023-03-15 Thread Dávid Suchan
Hello, Im trying to upgrage the db version to a newer one with the command: '/usr/lib/postgresql/14/bin/pg_upgrade --old-bindir /usr/lib/postgresql/9.6/bin --new-bindir /usr/lib/postgresql/14/bin --old-datadir /etc/postgresql/9.6/main --new-datadir /var/lib/postgresql/14/data -U postgres'

odd (maybe) procedure cacheing behaviour

2023-03-15 Thread Tim . Colles
See noddy example below (v14.6). Presumably this is a result of procedure cacheing as per docs. The EXECUTE plan is being prepared fresh (again as expected from the docs and per the error message) but is the input argument type of NEW.x for the format() call still cached? Is altering a table

Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-15 Thread Laurenz Albe
On Tue, 2023-03-14 at 17:50 -0700, Bryn Llewellyn wrote: > Section "43.7. Cursors” in the PL/pgSQL chapter of the doc > (www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS) > starts with this: > > « > [...] > A more interesting usage is to return a reference to a