Re: Error on query execution

2025-03-06 Thread Tom Lane
Igor Korot writes: > On Tue, Mar 4, 2025 at 8:37 PM Tom Lane wrote: >> ... but given that you didn't specify any data type, I think the >> parser will fall back to assuming that $1 is the same type as >> "abf_type", whatever that is. Passing data in bin

Re: How to debug: password authentication failed for user

2025-02-27 Thread Tom Lane
'$PASSWORD'"';' Note this will fall over with potential for SQL injection if there's a single quote in the password, so better not use it with untrusted input. On the whole I'd say "find some other way to do that". regards, tom lane

Re: ERROR: could not read block 0 in file when creating an index out of a function

2025-03-12 Thread Tom Lane
. And the case can't really happen without a function referencing the index's base table; for example, a query from another session can't see the uncommitted index at all. regards, tom lane

Re: Error on query execution

2025-03-04 Thread Tom Lane
is. Passing data in binary is not at all forgiving about getting the data type right. regards, tom lane

Re: Infinite loop for generate_series with timestamp arguments

2025-03-03 Thread Tom Lane
might get different results in different months. Another idea is to check, after doing each addition, to make sure that the timestamp actually advanced in the expected direction. But should we error out if not, or just stop? regards, tom lane

Re: Infinite loop for generate_series with timestamp arguments

2025-03-03 Thread Tom Lane
difficulty of identifying the sign of an interval. regards, tom lane diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 9682f9dbdca..202bbd1edcd 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -6622,6 +662

Re: psql command line editing

2025-02-12 Thread Tom Lane
e usual Emacs combinations Ctrl-A, Ctrl-E, Escape-B, Escape-F and so on work in psql. I don't believe I did anything special to configure that. Check your local readline documentation. As Adrian notes, there's also \e, which is good for entering or editing multi-line queries. regards, tom lane

Re: psql command line editing

2025-02-12 Thread Tom Lane
ng to that, but I've not checked into it. regards, tom lane

Re: Wasteful nested loop join when there is `limit` in the query

2025-02-16 Thread Tom Lane
think is better: an example with only half a dozen rows is going to be swamped by startup costs. regards, tom lane

Re: DROP ROLE as SUPERUSER

2025-02-21 Thread Tom Lane
Dominique Devienne writes: > On Fri, Feb 21, 2025 at 3:33 PM Tom Lane wrote: >> REASSIGN OWNED then DROP OWNED is the recommended path. > Hi. Am I missing something? foobar does not OWN anything in this case. > So I don't see how these recommendations are relevant to th

Re: DROP ROLE as SUPERUSER

2025-02-21 Thread Tom Lane
ED then DROP OWNED is the recommended path. regards, tom lane

Re: the postgr.es/m/MESSAGE_ID URL format

2025-02-24 Thread Tom Lane
ly > certain lists (like hackers)? It should work for any message that appears in our mail archives. It's just a shortcut for https://www.postgresql.org/message-id/MESSAGE_ID regards, tom lane

Re: #XX000: ERROR: tuple concurrently updated

2025-02-24 Thread Tom Lane
g distinct grants (not same grantor/grantee/granted roles). Wouldn't hurt to test. regards, tom lane

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread Tom Lane
have to say "GRANTED BY " to get that effect. I'm not entirely sure, but I think this is closer to what the SQL standard says. regards, tom lane

Re: #XX000: ERROR: tuple concurrently updated

2025-02-20 Thread Tom Lane
ently, > in two long running transactions? How am I supposed to resolve this? The window is probably too small to hit if each restore is committing as it goes, but if you run in --single-transaction mode then this isn't surprising. I'd say don't try to run concurrent restores. regards, tom lane

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread Tom Lane
"David G. Johnston" writes: > On Thu, Feb 20, 2025 at 9:05 AM Tom Lane wrote: >> It used to be that if a superuser issued GRANT/REVOKE, the operation >> was silently done as the owner of the affected object. > That is still the case according to the docs (REVOKE)

Re: How to return seto records from seof record function?

2025-02-25 Thread Tom Lane
te_subscripts($1, 1) i $function$ regression=# create or replace function wrapper(anyarray) RETURNS SETOF record LANGUAGE sql as $$ select 1; select array_to_set($1); $$; CREATE FUNCTION regression=# select wrapper(array[44,55,66]); wrapper - (1,44) (2,55) (3,66) (3 rows) regards, tom lane

Re: Querying one partition in a function takes locks on all partitions

2025-03-30 Thread Tom Lane
ry shortly [1]. Maybe somebody will be excited enough to consider changing the docs in the back branches. But since it was like this for a couple of decades, I bet not. regards, tom lane [1] https://www.postgresql.org/message-id/flat/8216639.NyiUUSuA9g%40aivenlaptop

Re: Querying one partition in a function takes locks on all partitions

2025-03-31 Thread Tom Lane
n's plan cache, but implemented in about the stupidest way possible. Jacking that up and rolling the plancache.c infrastructure underneath has been on my to-do list for years. regards, tom lane

Re: Postgres Query Plan using wrong index

2025-04-02 Thread Tom Lane
ed to be scanned as a consequence of noticing that the columns have significant correlation. The shape of that penalty function would be mostly guesswork though, I fear. (Even with a clear idea of what to do, making this happen seems a little complex --- just a SMOP, but I'm not very sure how to wire it up.) regards, tom lane

Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000

2025-03-22 Thread Tom Lane
ave autonomous transactions (not yet anyway), and you can't fake them like that. A way that does work, I believe, is to set up a second session with dblink[1] and use that to issue the autonomous transaction. Ugly and inefficient for sure, but if you've gotta have it...

Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000

2025-03-22 Thread Tom Lane
llowing the original INSERT (which was outside both subtransactions) to complete. regards, tom lane

Re: Restoring only a subset of schemas

2025-03-19 Thread Tom Lane
ide regex, which is a facility pg_restore doesn't have access to. Maybe it'd be good enough to implement the "*" and "?" wildcards and stop there, but I'm not sure. regards, tom lane

Re: How to pass a list of locations (longitude, latitude) to a PostgreSQL/PostGIS stored function?

2025-03-25 Thread Tom Lane
gsql's FOREACH SLICE syntax: https://www.postgresql.org/docs/devel/plpgsql-control-structures.html#PLPGSQL-FOREACH-ARRAY You could probably make a custom version of unnest that uses that and then keep your query about the same. regards, tom lane

Re: Postgres Query Plan using wrong index

2025-04-02 Thread Tom Lane
ntially usable for this query, and they all have different cost curves depending on how selective the col_a condition is. Even the index on col_b alone could potentially be the best, because it'll be smaller than the two-column indexes. So if the col_a condition is very unselective then it

Re: After upgrading libpq, the same function(PQftype) call returns a different OID

2025-04-04 Thread Tom Lane
"David G. Johnston" writes: > On Thu, Mar 20, 2025 at 2:56 PM Tom Lane wrote: >> That's documented elsewhere, I believe. For the foo_d.h files, >> I think it'd be sufficient to do something like 0001 attached. > WFM. Thanks. Thanks for looking at it. &

Re: are the 2 if-statements in join_is_legal() removable?

2025-05-10 Thread Tom Lane
ml#350 regards, tom lane

Re: Postgresql 18beta1 and SPI changes

2025-05-11 Thread Tom Lane
? If you think there are changes we need to make, you'd better get specific sooner not later. I'm not aware of any large fixes that are pending, cf https://wiki.postgresql.org/wiki/PostgreSQL_18_Open_Items regards, tom lane

Re: 回复: are the 2 if-statements in join_is_legal() removable?

2025-05-11 Thread Tom Lane
rticularly short on coverage here: one or the other code path is fully exercised in each case, according to the coverage.postgresql.org results. regards, tom lane

Re: Updating to PostgreSQL 17.5

2025-05-11 Thread Tom Lane
eans. Sorry --- it means BRIN indexes that use one of the "xxx_bloom_ops" opclasses. https://www.postgresql.org/docs/current/brin.html#BRIN-BUILTIN-OPCLASSES regards, tom lane

Re: Feature-Request: Performance-Optimization when using limit in combination with order by on querys using union

2025-05-08 Thread Tom Lane
;s an additional optimization blocker. I'd look closely at whether the output column types of the UNION arms match. regards, tom lane

Re: Index not used in certain nested views but not in others

2025-05-13 Thread Tom Lane
that's your problem. The source tables' column types need to match. Otherwise the UNIONs don't get flattened and you don't get indexscans. regards, tom lane

Re: Index not used in certain nested views but not in others

2025-05-13 Thread Tom Lane
Markus Demleitner writes: > On Tue, May 13, 2025 at 10:12:46AM -0400, Tom Lane wrote: >> Oh, well, that's your problem. The source tables' column types >> need to match. Otherwise the UNIONs don't get flattened and you >> don't get indexscans. > Ahhh

Re: PostgreSQL 15.10 update corrective action for ATTACH PARTITION/DETACH PARTITION

2025-05-27 Thread Tom Lane
Alvaro Herrera writes: > I'm going to fix the query in the release notes for all past branches > now, to avoid confusing people upgrading in the future ... hopefully not > many, but I don't think it's going to be zero people. OK, thanks. regards, tom lane

Re: where to find pg coverage report of history release

2025-05-15 Thread Tom Lane
ugh: https://www.postgresql.org/docs/current/regress-coverage.html regards, tom lane

Re: How to subscribe to pgsql-hack...@postgresql.org

2025-06-02 Thread Tom Lane
"lists." is preferred nowadays, but there is no functional difference. regards, tom lane

Re: Stably escaping an identifier

2025-06-15 Thread Tom Lane
ssues in some contexts. regards, tom lane

Re: password rules

2025-06-23 Thread Tom Lane
iness of using passwords rather than other ID technologies (SSL certificates, Kerberos/GSS tickets, etc) is feeling pretty twentieth-century. regards, tom lane

Re: pg_restore ERROR: permission denied to change default privileges

2025-06-13 Thread Tom Lane
ot;my_database_ro"; Well, you aren't going to be able to do that if you're not superuser. You could undo that ALTER in the source database and re-make the dump, or edit the dump script to remove this command, or not use pg_restore's "-1" switch and just ignore this error. regards, tom lane

Re: Getting error "too many clients already" despite having a db connection limit set

2025-06-16 Thread Tom Lane
r a new backend process to figure out which database it's supposed to connect to and then detect whether the per-DB connection limit is exceeded. In the meantime, that session does count against the global limit, so yeah this isn't surprising if the connection arrival rate is high enough.

Re: Low OIDs (< 16384) when creating databases in single user mode

2025-06-06 Thread Tom Lane
Arnold Hendriks writes: > Is there a way to ensure new IDs are in the usual range when starting > in in single user mode? No. Start the DB in normal mode, then create objects that you want to be considered user-defined. regards, tom lane

Re: Combining scalar and row types in RETURNING

2025-06-03 Thread Tom Lane
list of all of t's columns, just as would happen in a SELECT's output list. Try returning merge_action(), t It might also be necessary to declare the target variable "m_new_data" as being of type my_table rather than generic "record"; not sure about that. regards, tom lane

Re: Combining scalar and row types in RETURNING

2025-06-03 Thread Tom Lane
te field). I didn't try this approach though. regards, tom lane

Re: Yet more ROLE changes in v18 beta1???

2025-06-04 Thread Tom Lane
R triggers run as the instigating user. regards, tom lane

Re: Feature request: Settings to disable comments and multiple statements in a connection

2025-06-04 Thread Tom Lane
an option in the client execute functions (and/or implement > the backend support) to specify the expected number of statements. I don't see the need for this given #2. regards, tom lane

Re: Yet more ROLE changes in v18 beta1???

2025-06-04 Thread Tom Lane
, we'd much rather find it and fix it before 18.0 comes out. regards, tom lane

Re: Changing a varchar(7) domain into text directly in pg_type

2025-05-28 Thread Tom Lane
ndroppable built-in types, we don't bother to make dependencies on them. And you're not changing the domain's schema or owner, so its other dependencies don't need to change. regards, tom lane

Re: Is it correct to raise an exception in a domain check

2025-06-10 Thread Tom Lane
or handling in COPY. As you say, there are some cases where it's hard to avoid an exception, but I'm not sure that "better error message" is a good justification for throwing one. Still, in the end it's your own judgment to make. regards, tom lane

Re: is pg_stat_activity "transactional"? How fast does it update?

2025-06-10 Thread Tom Lane
tivity() takes a snapshot of the view's contents and then holds onto that snapshot until end of transaction. You can get around that with pg_stat_clear_snapshot(). regards, tom lane

Re: Feature request: Settings to disable comments and multiple statements in a connection

2025-06-07 Thread Tom Lane
ty hazards already. We'd do better to remove them, not add more. So in short, while it would not be terribly hard to put in what you suggest, we'd be creating a lot of work for people other than ourselves. And the end result when all the dust had settled would likely be just marginal security gains for a small subset of users. regards, tom lane

Re: pg_upgrade: can I use same binary for old & new?

2025-07-05 Thread Tom Lane
it a try; be sure to use one of the pg_dump modes that compress the data. regards, tom lane

Re: pg_upgrade: can I use same binary for old & new?

2025-07-05 Thread Tom Lane
to some less PG-unfriendly distro while you are at it. regards, tom lane

Re: pg_upgrade: can I use same binary for old & new?

2025-07-05 Thread Tom Lane
ly (mainly to capture your role definitions) and then pg_dump each database into a separate compressed file. regards, tom lane

Re: Logical Replication 08P01 invalid memory alloc request size 1095736448

2025-07-06 Thread Tom Lane
essage-id/flat/680bdaf6-f7d1-4536-b580-05c2760c67c6%40deepbluecap.com We'll have a fix in next month's quarterly releases. For the moment, you could either roll back to 15.12 or cherry-pick the fix at commit fc0fb77c5. regards, tom lane

Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)

2025-07-14 Thread Tom Lane
ite permissions on the mount point, which dictates making a separate data directory (with different ownership/permissions) just below the mount. Do not bypass that ownership/permissions check. It is there for very good reasons. regards, tom lane

Re: Corrupt btree index includes rows that don't match

2025-07-04 Thread Tom Lane
things, both during inserts and searches". If you had some evidence about when and how the index became corrupt, it'd be worth studying that, but it sounds like you don't. regards, tom lane

Re: Lock timeout in commit

2025-07-10 Thread Tom Lane
ate before it fails. It occurs to me to wonder though if we couldn't provide more context in the error about what lock is being waited for. regards, tom lane

Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)

2025-07-14 Thread Tom Lane
"Peter J. Holzer" writes: > On 2025-07-14 10:07:20 -0400, Tom Lane wrote: >> That is primarily for safety reasons: if for some reason the >> filesystem gets dismounted, or hasn't come on-line yet during >> a reboot, you do not want Postgres to be able to wr

Re: optimizing number of workers

2025-07-14 Thread Tom Lane
ike that. There might be related discussion in our archives, but finding it could be difficult.) regards, tom lane

Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)

2025-07-14 Thread Tom Lane
storage. (But I too would not use Postgres-over-NFS for any critical data. Too many moving parts. It's tough enough to ensure crash safety with local storage.) regards, tom lane

Re: Regarding query optimisation (select for update)

2025-07-15 Thread Tom Lane
apply to large tables. regards, tom lane [1] https://www.postgresql.org/docs/current/using-explain.html#USING-EXPLAIN-CAVEATS

Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)

2025-07-16 Thread Tom Lane
that should have gone out with floppy disks. You need some extremely fundamental re-examination of your design decisions. At the moment I am content to say that Postgres does not support this storage mechanism and we do not intend to do so in the future. regards, tom lane

<    25   26   27   28   29   30