Re: valgrind a background worker

2023-02-10 Thread Tom Lane
d with --trace-children=yes. For leak tracking you probably also want --leak-check=full --track-origins=yes --read-var-info=yes regards, tom lane

Re: pg_trgm vs. Solr ngram

2023-02-09 Thread Tom Lane
d without hacking C code. regards, tom lane

Re: Boyer-Moore string searching in LIKE, ILIKE, and/or POSITION?

2023-02-08 Thread Tom Lane
e a net loss in some use-cases. We do manage to get past that --- the position() code didn't have BMH to start with --- but it definitely requires solid evidence. regards, tom lane

Re: How to create directory format backup

2023-02-08 Thread Tom Lane
rid of the 4GB limit on stat() results in v14, or so we thought. Anyway, as far as I can find pg_dump can only reach that error message via fsync_dir_recurse(), which suggests that a workaround might be to add --no-sync so it doesn't try to fsync its output. regards, tom lane

Re: ALTER COLUMN to change GENERATED ALWAYS AS expression?

2023-02-07 Thread Tom Lane
he dropped >> column replaced by a null value." > VACUUM FULL doesn't rewrite the table? It moves all the tuples into a new file, but it does not rebuild individual tuples, as would be needed to delete column values. regards, tom lane

Re: Question regarding UTF-8 data and "C" collation on definition of field of table

2023-02-05 Thread Tom Lane
ion/lctype? No, at least not in Postgres. regards, tom lane

Re: Question regarding UTF-8 data and "C" collation on definition of field of table

2023-02-05 Thread Tom Lane
ur shoulders and stick with C collation. It's likely to be faster than any alternative. regards, tom lane

Re: Question regarding UTF-8 data and "C" collation on definition of field of table

2023-02-05 Thread Tom Lane
is likely to look odd. How much do you care about that? regards, tom lane

Re: From Clause Conditional

2023-02-02 Thread Tom Lane
g this all to a constant if so, whereas older ones might not have. If you care about when/whether crypto_secretbox_open runs, then it must have side-effects, so it shouldn't be IMMUTABLE. regards, tom lane

Re: FATAL: database "xxx" does not exist when it does

2023-02-01 Thread Tom Lane
Especially if you are using version-mismatched psql and libpq, which seems moderately likely. regards, tom lane

Re: "SELECT FROM foo" acts like "SELECT COUNT(*) FROM foo"?

2023-02-01 Thread Tom Lane
u get some number of zero-column rows. psql's display of that is a bit idiosyncratic, but nobody's bothered to improve it. regards, tom lane

Re: VACUUM vs VACUUM FULL (was: SELECT * FROM huge_table LIMIT 10; Why does it take more than 10 min to complete, with cold caches)

2023-02-01 Thread Tom Lane
rong thing. (You might be thinking of the free-space map, but we don't maintain that rigorously enough to trust it as a guide to skipping pages.) regards, tom lane

Re: 38.10.6. Composite-Type Arguments C-language function code demo works for int, but not for numeric.

2023-02-01 Thread Tom Lane
wo pointers-to-numerics, not the values of the numerics. You'd need to invoke numeric_cmp() if you want a sensible result. regards, tom lane

Re: SELECT * FROM huge_table LIMIT 10; Why does it take more than 10 min to complete, with cold caches

2023-01-31 Thread Tom Lane
Dimitrios Apostolou writes: > On Tue, 31 Jan 2023, Tom Lane wrote: >> Do you get the same 10 rows when you repeat the command? > Yes. Just tested with both cold and hot caches. The first 10 rows are > exactly the same, either they return slowly or immediately. Hm. I don'

Re: SELECT * FROM huge_table LIMIT 10; Why does it take more than 10 min to complete, with cold caches

2023-01-31 Thread Tom Lane
the next desert of dead tuples. If turning synchronize_seqscans off changes the behavior, that'd be a good clue that this is the right theory. As for a real fix, it might be time for a VACUUM FULL or CLUSTER on that table. regards, tom lane

Re: Sequence vs UUID

2023-01-30 Thread Tom Lane
with dashes (36 bytes + length overhead), the gap would > narrow. Yeah, especially if your database is not using C locale. The strcoll or ICU-based comparisons done on string types can be enormously more expensive than the memcmp() used for binary types like native uuid. regards, tom lane

Re: How to control pg_catalog results for each users?

2023-01-29 Thread Tom Lane
would be just as broken if we restricted this. regards, tom lane

Re: Indexes mysteriously change to ON ONLY

2023-01-27 Thread Tom Lane
ING btree (f1) foo_2 | foo_2_pkey | CREATE UNIQUE INDEX foo_2_pkey ON public.foo_2 USING btree (f1) (3 rows) If you wanted to reconstruct this from individual parts, as pg_dump does, you'd issue those commands and then connect them together with ATTACH PARTITION commands. regards, tom lane

Re: Indexes mysteriously change to ON ONLY

2023-01-27 Thread Tom Lane
es to you that way. If that tool is pg_dump, this is its normal behavior. There will be other commands in its output that build the rest of the partitioned index set. regards, tom lane

Re: Database size different on Primary and Standby?

2023-01-18 Thread Tom Lane
ing kept around could be different. regards, tom lane

Re: Interpreting postgres execution plan along with AND/OR precedence

2023-01-18 Thread Tom Lane
IN notation is gone.) > I'm trying to understand the precedence of AND/OR operations when > everything is not tied together with ()'s. The OR is lower priority than all the ANDs, so yeah moving some clauses to be after the OR would change the semantics. I think you probably need some more parentheses here; it's not clear exactly what semantics you are after. regards, tom lane

Re: row estimate for partial index

2023-01-16 Thread Tom Lane
Harmen writes: > On Sat, Jan 14, 2023 at 11:23:07AM -0500, Tom Lane wrote: >> If you are running a reasonably recent PG version you should be able to >> fix that by setting up "extended statistics" on that pair of columns: > CREATE STATISTICS dist4 (ndisti

Re: pg_upgrade 13.6 to 15.1?

2023-01-15 Thread Tom Lane
refresh your memory on what that was. regards, tom lane

Re: pg_upgrade 13.6 to 15.1?

2023-01-15 Thread Tom Lane
un there would still be two copies of the DB on the new disk, which doesn't seem like what he wants. regards, tom lane

Re: pg_upgrade 13.6 to 15.1?

2023-01-15 Thread Tom Lane
p...@pfortin.com writes: > On Sun, 15 Jan 2023 14:47:35 -0500 Tom Lane wrote: >> I think you misunderstand how this is supposed to work. The -D >> argument should point at an *empty* data directory that has been >> freshly initialized with the new version's initdb. pg

Re: pg_upgrade 13.6 to 15.1?

2023-01-15 Thread Tom Lane
itialized with the new version's initdb. pg_upgrade then transfers data into that from the old database (-d argument). regards, tom lane

Re: row estimate for partial index

2023-01-14 Thread Tom Lane
t by setting up "extended statistics" on that pair of columns: https://www.postgresql.org/docs/current/planner-stats.html#PLANNER-STATS-EXTENDED (I might be wrong, but I think that will help even when one of the troublesome conditions is a null-check. If it doesn't, then we have something to improve there ...) regards, tom lane

Re: Why is a hash join preferred when it does not fit in work_mem

2023-01-14 Thread Tom Lane
rming the sort using an index scan instead of a bespoke sort step. AFAIR, cost_sort doesn't consider random_page_cost at all, and neither does cost_hashjoin. regards, tom lane

Re: synchronized standby: committed local and waiting for remote ack

2023-01-13 Thread Tom Lane
a different set of failure modes. It'd be particularly bad if you have more than one standby, because you could easily get into a situation where *none* of the nodes represent truth. regards, tom lane

Re: Intervals and ISO 8601 duration

2023-01-13 Thread Tom Lane
is not what Ken is after IIUC. regards, tom lane

Re: Intervals and ISO 8601 duration

2023-01-13 Thread Tom Lane
t() keywords to make that easier. regards, tom lane

Re: Intervals and ISO 8601 duration

2023-01-12 Thread Tom Lane
croseconds. If we're forced to interconvert between those units, we use 30 days = 1 month and 24 hours = 1 day, but it's usually best to avoid doing that. regards, tom lane

Re: EXPLAIN and FK references?

2023-01-11 Thread Tom Lane
Ron writes: > On 1/12/23 00:07, Tom Lane wrote: >> No, not directly, but you could look at EXPLAIN ANALYZE to see which >> of the RI triggers is eating the time. > Good to know, but even deleting one day of data (90,000 rows using an index > scan on the date field) takes

Re: EXPLAIN and FK references?

2023-01-11 Thread Tom Lane
references (index scan, seq scan, etc) during deletes (and > inserts and updates)? No, not directly, but you could look at EXPLAIN ANALYZE to see which of the RI triggers is eating the time. It's not going to be hard to figure out which one(s) are using indexed plans and which are not. regards, tom lane

Re: Autovacuum Hung Due to Bufferpin

2023-01-11 Thread Tom Lane
don't think there's any ready way to discover that from SQL level. regards, tom lane

Re: Autovacuum Hung Due to Bufferpin

2023-01-11 Thread Tom Lane
h to do that. If you have a constant stream of readers it will never be able to get that lock. You'll need to find a way to momentarily block those readers. regards, tom lane

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Tom Lane
closer to shared_buffers, as it seems to indicate that fetches from kernel space are pretty expensive on your platform.) regards, tom lane

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Tom Lane
inner or has the indexed table on the nullable side. We have no support for nestloop right join, which is what would be needed to make things run fast with no index on B. regards, tom lane

Re: Updating column default values in code

2023-01-06 Thread Tom Lane
generate ALTER VIEW v ALTER COLUMN c SET DEFAULT LOCALTIMESTAMP(0) commands doesn't do what you need? regards, tom lane

Re: PostgreSQL 12 service failing in Ubuntu 20.04 after a few hours

2023-01-01 Thread Tom Lane
;s not allowing non-credentialed logins from anywhere. And for pete's sake don't use a guessable password. regards, tom lane

Re: dropped default locale

2022-12-21 Thread Tom Lane
uot;pin" entries. regards, tom lane

Re: integer square root function proposed

2022-12-17 Thread Tom Lane
described in > 8.1 Numeric Types). Our integers do not have infinities, nor NaNs. Anyway, I don't mean to slam the door on this idea completely, but I think you need to make a much better-supported argument for it. regards, tom lane

Re: Postgres Date Type Value

2022-12-17 Thread Tom Lane
date is 8333 by my math. Looking at the bit-pattern for 1,466,004,328: 0x57617368, it seems totally unrelated, more like ASCII text ("Wash") than anything else. You sure you're reading the right column of the result? regards, tom lane

Re: tsvector not giving expected results on one host

2022-12-17 Thread Tom Lane
s 'exampl', then only the first of these will match. So IMO the question is not "why is it failing on prod?", it's "how the heck did it work on the other machine?". You won't get nice results if websearch_to_tsquery is using a different TS configuration than to_tsvector did. regards, tom lane

Re: pg_dumpall renders ALTER TABLE for a view?

2022-12-15 Thread Tom Lane
to making pg_dump emit the more modern spelling (I think ... you'd need to look into pg_restore to make sure it's not assuming something in this area). But doing that won't really remove the hazard. regards, tom lane

Re: tcp keepalives not sent during long query

2022-12-15 Thread Tom Lane
r I'd expect on a local (Unix-socket) connection ... you sure you're doing this from one of the problematic clients? regards, tom lane

Re: Test if a database has any privilege granted to public

2022-12-14 Thread Tom Lane
(3 rows) regards, tom lane

Re: tcp keepalives not sent during long query

2022-12-14 Thread Tom Lane
e certain that you applied the configuration change to your new installation? It'd be worth doing show tcp_keepalives_idle; in one of the sessions where you are having trouble. And maybe check the other keepalives settings too? regards, tom lane

Re: compiling postgres on windows - how to deal with unmatched file extension?

2022-12-13 Thread Tom Lane
have seen associated errors earlier in the build log. regards, tom lane

Re: Is there a way to detect that code is inside CREATE EXTENSION?

2022-12-13 Thread Tom Lane
better look at the in_extension fields of CollectedCommands. I don't think we expose that state at the SQL level, but it's pretty hard to make a useful event trigger without writing any C ... regards, tom lane

Re: Re[2]: PG 14.5 -- Impossible to restore dump due to interaction/order of views, functions, and generated columns

2022-12-07 Thread Tom Lane
rts of misbehaviors might ensue from that, but I'm pretty certain that the data in the GENERATED column after dump/restore won't match what you had there beforehand. regards, tom lane

Re: PG 14.5 -- Impossible to restore dump due to interaction/order of views, functions, and generated columns

2022-12-06 Thread Tom Lane
dump has some heuristics for dealing with such cases, but maybe it needs more. Please create a self-contained example and submit it to pgsql-bugs. regards, tom lane

Re: print in plpython not appearing in logs

2022-12-03 Thread Tom Lane
not a Postgres question. Maybe you need an explicit fflush-equivalent step? Dunno. regards, tom lane

Re: Views "missing" from information_schema.view_table_usage

2022-12-02 Thread Tom Lane
matviews and sequences. Some other projects adopt more liberal views about what should be shown in those views, but that one is our policy. regards, tom lane

Re: Stored procedure code no longer stored in v14 and v15, changed behaviour

2022-12-02 Thread Tom Lane
t telling so, but don't change the text > until next alter procedure is run. I'm astonished at the number of people who think that poorly-implemented Oracle behavior is something we should emulate. regards, tom lane

Re: Stored procedure code no longer stored in v14 and v15, changed behaviour

2022-12-01 Thread Tom Lane
ee the contradictions in this? You want the database to preserve the original DDL, but you also want it to update in response to subsequent alterations. You can't have both those things. regards, tom lane

Re: how to secure pg_hba.conf

2022-12-01 Thread Tom Lane
hat's to stop the same actors from examining/modifying other configuration files, or even the actual database contents? If you don't think your data directory is secure, you have problems that Postgres can't fix. regards, tom lane

Re: Stored procedure code no longer stored in v14 and v15, changed behaviour

2022-12-01 Thread Tom Lane
se it couldn't be maintained in a reasonable way. I think the answer here is "don't use the new syntax if you want the function body stored textually". You can have one set of benefits, or the other set, but not both at once. regards, tom lane

Re: Finding free time period on non-continous tstzrange field values

2022-12-01 Thread Tom Lane
tstzmultirange | | func pg_catalog | tstzmultirange | tstzmultirange | VARIADIC tstzrange[] | func pg_catalog | tstzmultirange | tstzmultirange | tstzrange | func (3 rows) My guess is that your server is not in fact PG14, but some older version. regards, tom lane

Re: delete statement returning too many results

2022-11-29 Thread Tom Lane
Harmen writes: > On Mon, Nov 28, 2022 at 12:11:53PM -0500, Tom Lane wrote: >> So basically it's unsafe to run the sub-select more than once, >> but the query as written leaves it up to the planner whether >> to do that. I'd suggest rephrasing as [...] > I'

Re: Re: Seeking the correct term of art for the (unique) role that is usually called "postgres"—and the mental model that underlies it all

2022-11-29 Thread Tom Lane
imes worth saying "database superuser" to ensure that you don't confuse people who might think of some external-to-Postgres meaning of "superuser", but otherwise plain "superuser" is fine. And we've settled on "bootstrap superuser" as the best term for the role with OID 10. So the present set of glossary entries looks fine to me. regards, tom lane

Re: Upgrading to v12

2022-11-28 Thread Tom Lane
those enabled. > Is there anything else I want from initdb? If you can connect to the new installation, then you're done with that part, and can get on with the dump-and-restore part. regards, tom lane

Re: delete statement returning too many results

2022-11-28 Thread Tom Lane
BY id LIMIT 1 FOR UPDATE SKIP LOCKED ) DELETE FROM queue WHERE id IN (SELECT * FROM target_rows) RETURNING *; regards, tom lane

Re: collect2: error: ld returned 1 exit status

2022-11-26 Thread Tom Lane
stated command? BTW, it's pretty hard to believe that you need to use sudo for this. regards, tom lane

Re: Practical maximum max_locks_per_transaction?

2022-11-25 Thread Tom Lane
as big as you want on any reasonably modern machine. I wouldn't blink at a few million locktable entries, at least not on 64-bit hardware. regards, tom lane

Re: Index-only scan not working when IN clause has 2 or more values

2022-11-25 Thread Tom Lane
s sorted by trans_dttm anyway. You might try making extended stats on these three columns to see if that helps the planner to get a better rowcount estimate. If it understood that there were fewer than 50 matching rows, it might opt for the use-the-=ANY-and-sort plan type. regards, tom lane

Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

2022-11-23 Thread Tom Lane
e an easy quick-fix. We'd need to refactor so that the cleanup housekeeping at the bottom of psql_completion() was in a wrapper function, but perhaps that wouldn't be too messy. regards, tom lane

Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

2022-11-23 Thread Tom Lane
Andres Freund writes: > On 2022-11-23 18:11:22 -0500, Tom Lane wrote: >> Huh ... do you recall the details? Large as tab-complete is, it's >> far smaller than gram.y: > So It might just be that we need to split up that very long "else if" chain in > psql_com

Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

2022-11-23 Thread Tom Lane
Andres Freund writes: > On 2022-11-21 10:58:06 -0500, Tom Lane wrote: >> It'd certainly be nice if we could use Readline on Windows. > 2) The last time I checked, msvc couldn't preprocess tab-complete.c with >USE_READLINE defined, due to running into some pr

Re: table inheritance partition and indexes

2022-11-23 Thread Tom Lane
to INHERITS-style partitioning. regards, tom lane

Re: Index filter instead of index condition w/ IN / ANY queries above certain set size

2022-11-23 Thread Tom Lane
stgresql.org/docs/current/indexes-multicolumn.html That is, tid and tidh need to be the first two index columns. regards, tom lane

Re: security label and indexes

2022-11-22 Thread Tom Lane
. From a security standpoint, they're implementation details of the table they belong to. Whatever usage restrictions you want should be put on the table, instead. regards, tom lane

Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

2022-11-21 Thread Tom Lane
to buy into maintaining our own fork of Readline, if that's what you're trying to suggest. If it "just works" now, that'd be great. Otherwise, maybe you should be speaking to the Readline maintainers about what changes are needed in it? regards, tom lane

Re: Duda sobre como imprimir un campo INTERVAL

2022-11-19 Thread Tom Lane
a linear sort order if we want to support btree indexes or ORDER BY on intervals. You can use justify_hours() to get from '26 hours' to '1 day 2 hours'. I'm not sure if there's a compact way to go the other direction, though you could always use extract() to get the components and sum them up. regards, tom lane

Re: RES: RES: session_user different from current_user after normal login

2022-11-18 Thread Tom Lane
ain it ... what applied that setting? regards, tom lane

Re: Lots of read activity on index only scan

2022-11-18 Thread Tom Lane
map is fully set. Did you vacuum this table after building it, or wait long enough for autovacuum to do so? regards, tom lane

Re: Appetite for `SELECT ... EXCLUDE`?

2022-11-18 Thread Tom Lane
ariation in how you spell it, where you can write it, and so on. My own inclination is to not do anything here until/unless the SQL committee standardizes something, because there's too much risk of finding ourselves incompatible with the standard. regards,

Re: Calculating average block write time

2022-11-18 Thread Tom Lane
would have much real-world significance if we did calculate it. You could argue that read() is also squishy since it might be satisfied from kernel buffers rather than actually getting bits off the disk. However, there is some physical reality there: before read() we did not have the data, and afterwards we do. regards, tom lane

Re: RES: session_user different from current_user after normal login

2022-11-18 Thread Tom Lane
f any such settings. I can't offhand think of any other server-side configuration that would do it. regards, tom lane

Re: Drop role cascade ?

2022-11-17 Thread Tom Lane
Ron writes: > On 11/17/22 17:16, Tom Lane wrote: >> Not directly, but see REASSIGN OWNED and DROP OWNED. > SIMULATE and VERBOSE options would be handy, to see what those commands > would actually do. Hmph. I'm surprised to realize that those commands don't produce t

Re: Drop role cascade ?

2022-11-17 Thread Tom Lane
get rid of this role without revoking xxx in all > the individual DB objects he has privs too? Something like "drop role xxx > cascade" ? Not directly, but see REASSIGN OWNED and DROP OWNED. regards, tom lane

Re: Postgresql 11.3 doesn't use gist index on polygon column

2022-11-17 Thread Tom Lane
polygon,polygon) |9 | search gist | poly_ops| <<|(polygon,polygon) | 10 | search gist | poly_ops| |>>(polygon,polygon) | 11 | search gist | poly_ops| |&>(polygon,polygon) | 12 | search gist | poly_ops| <->(polygon,point) | 15 | ordering (13 rows) regards, tom lane

Re: unrecognized node type: 350

2022-11-16 Thread Tom Lane
headers. But you'd expect that it largely wouldn't work at all if so.) regards, tom lane

Re: unrecognized node type: 350

2022-11-16 Thread Tom Lane
shashidhar Reddy writes: > Extension version is 2.2. Is anything need to be done? To fix this issue? You could start by getting the information I asked for, ie where is this error being thrown from according to log_error_verbosity=verbose. regards, tom lane

Re: unrecognized node type: 350

2022-11-16 Thread Tom Lane
check. It might or might not be related to the node-type error. regards, tom lane

Re: unrecognized node type: 350

2022-11-16 Thread Tom Lane
e any basis for filing a bug report. regards, tom lane

Re: unrecognized node type: 350

2022-11-16 Thread Tom Lane
ostmaster log. regards, tom lane

Re: pg_restore remap schema

2022-11-16 Thread Tom Lane
his at dump time, you could just temporarily rename the schema on the server while making the dump. (Not that that would fix function bodies either.) regards, tom lane

Re: pg_restore remap schema

2022-11-16 Thread Tom Lane
ally with > dynamic queries in PL/pgsql. Yeah --- I fear there is no hope of making a feature like this that works reliably enough that we'd accept it. pg_restore is just not that smart about what is in the chunks of DDL that it processes, and trying to make it smart enough is a losing game. regards, tom lane

Re: unrecognized node type: 350

2022-11-16 Thread Tom Lane
the like)? regards, tom lane

Re: Calling function from VFP changes character field to Memo

2022-11-15 Thread Tom Lane
(firstname character(30), ...); create function testfunction() returns setof testfunction_result as ... regards, tom lane

Re: PostgreSQL server "idle in transaction"

2022-11-15 Thread Tom Lane
rg/docs/current/ecpg-commands.html#ECPG-TRANSACTIONS regards, tom lane

Re: PANIC: could not flush dirty data: Cannot allocate memory

2022-11-14 Thread Tom Lane
quest didn't get queued for lack of in-kernel memory space ... in which case "nothing happened". regards, tom lane

Re: PANIC: could not flush dirty data: Cannot allocate memory

2022-11-14 Thread Tom Lane
ncy is preserved; without it we can't offer any guarantees. regards, tom lane

Re: ON CONFLICT and WHERE

2022-11-13 Thread Tom Lane
a bit of a foot-gun. I wonder if we should make it safer by insisting that the resolved index be partial when there's a WHERE clause here. (This documentation text is about as clear as mud, too. What does "inferred" mean here? I think it means "chosen as arbiter index", but maybe I misunderstand.) regards, tom lane

Re: Upgrading to v12

2022-11-12 Thread Tom Lane
that the older pg_dump might have bugs that are fixed in the newer version. But such bugs are rare, so usually it'll work fine to use the older one. We do endeavor to make sure that older dump output will load into newer versions, because in disaster-recovery scenarios an older dump might be all you have. regards, tom lane

Re: Printf-like function

2022-11-11 Thread Tom Lane
Igor Korot writes: > Is there a printf-lilke function inside libpq that can be used > to create a proper query string with the proper quoting of the > literal? No. You'd be better off to transmit the literal value as a parameter. regards, tom lane

Re: Upgrading to v12

2022-11-11 Thread Tom Lane
here. Nonetheless, your path forward is clear: use pg_dump (or better pg_dumpall) and then load the output into a freshly initdb'd v12 installation. It'll be a bit slower than the pg_upgrade way, but it'll work. regards, tom lane

Re: Upgrading to v12

2022-11-11 Thread Tom Lane
Corruption but in general the news is not going to be good. regards, tom lane

Re: pg_isready mandatory parameters?

2022-11-11 Thread Tom Lane
onder what you get from psql with the same command line option sets. regards, tom lane

<    1   2   3   4   5   6   7   8   9   10   >