dhlin
Repos
3
Followers
20
Following
192

a powerful mysql toolset with Go

3880
822

OpenID Connect Relying Party and OAuth 2.0 Resource Server implementation in Lua for NGINX / OpenResty

796
208

设计模式 Golang实现-《研磨设计模式》读书笔记

7017
1766

Reolink camera api in Go

11
2

Events

delete branch
dhlin delete branch b/5891c7a8ed8f2d3d577e7eea34dacff12d7b6bbd
Created at 4 days ago
pull request closed
pgstat: store statistics in shared memory.

Previously the statistics collector received statistics updates via UDP and shared statistics data by writing them out to temporary files regularly. These files can reach tens of megabytes and are written out up to twice a second. This has repeatedly prevented us from adding additional useful statistics.

Now statistics are stored in shared memory. Statistics for variable-numbered objects are stored in a dshash hashtable (backed by dynamic shared memory). Fixed-numbered stats are stored in plain shared memory.

The header for pgstat.c contains an overview of the architecture.

The stats collector is not needed anymore, remove it.

By utilizing the transactional statistics drop infrastructure introduced in a prior commit statistics entries cannot "leak" anymore. Previously leaked statistics were dropped by pgstat_vacuum_stat(), called from [auto-]vacuum. On systems with many small relations pgstat_vacuum_stat() could be quite expensive.

Now that replicas drop statistics entries for dropped objects, it is not necessary anymore to reset stats when starting from a cleanly shut down replica.

Subsequent commits will perform some further code cleanup, adapt docs and add tests.

Bumps PGSTAT_FILE_FORMAT_ID.

Author: Kyotaro Horiguchi horikyota.ntt@gmail.com Author: Andres Freund andres@anarazel.de Author: Melanie Plageman melanieplageman@gmail.com Reviewed-By: Andres Freund andres@anarazel.de Reviewed-By: Thomas Munro thomas.munro@gmail.com Reviewed-By: Justin Pryzby pryzby@telsasoft.com Reviewed-By: "David G. Johnston" david.g.johnston@gmail.com Reviewed-By: Tomas Vondra tomas.vondra@2ndquadrant.com (in a much earlier version) Reviewed-By: Arthur Zakirov a.zakirov@postgrespro.ru (in a much earlier version) Reviewed-By: Antonin Houska ah@cybertec.at (in a much earlier version) Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de Discussion: https://postgr.es/m/20210319235115.y3wz7hpnnrshdyv6@alap3.anarazel.de

Created at 4 days ago
delete branch
dhlin delete branch b/be902e26510788c70a874ea54bad753b723d018f
Created at 4 days ago
pull request opened
pgstat: store statistics in shared memory.

Previously the statistics collector received statistics updates via UDP and shared statistics data by writing them out to temporary files regularly. These files can reach tens of megabytes and are written out up to twice a second. This has repeatedly prevented us from adding additional useful statistics.

Now statistics are stored in shared memory. Statistics for variable-numbered objects are stored in a dshash hashtable (backed by dynamic shared memory). Fixed-numbered stats are stored in plain shared memory.

The header for pgstat.c contains an overview of the architecture.

The stats collector is not needed anymore, remove it.

By utilizing the transactional statistics drop infrastructure introduced in a prior commit statistics entries cannot "leak" anymore. Previously leaked statistics were dropped by pgstat_vacuum_stat(), called from [auto-]vacuum. On systems with many small relations pgstat_vacuum_stat() could be quite expensive.

Now that replicas drop statistics entries for dropped objects, it is not necessary anymore to reset stats when starting from a cleanly shut down replica.

Subsequent commits will perform some further code cleanup, adapt docs and add tests.

Bumps PGSTAT_FILE_FORMAT_ID.

Author: Kyotaro Horiguchi horikyota.ntt@gmail.com Author: Andres Freund andres@anarazel.de Author: Melanie Plageman melanieplageman@gmail.com Reviewed-By: Andres Freund andres@anarazel.de Reviewed-By: Thomas Munro thomas.munro@gmail.com Reviewed-By: Justin Pryzby pryzby@telsasoft.com Reviewed-By: "David G. Johnston" david.g.johnston@gmail.com Reviewed-By: Tomas Vondra tomas.vondra@2ndquadrant.com (in a much earlier version) Reviewed-By: Arthur Zakirov a.zakirov@postgrespro.ru (in a much earlier version) Reviewed-By: Antonin Houska ah@cybertec.at (in a much earlier version) Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de Discussion: https://postgr.es/m/20210319235115.y3wz7hpnnrshdyv6@alap3.anarazel.de

Created at 4 days ago
create branch
dhlin create branch b/be902e26510788c70a874ea54bad753b723d018f
Created at 4 days ago
create branch
dhlin create branch b/5891c7a8ed8f2d3d577e7eea34dacff12d7b6bbd
Created at 4 days ago

Default to hidden visibility for extension libraries where possible

Until now postgres built extension libraries with global visibility, i.e. exporting all symbols. On the one platform where that behavior is not natively available, namely windows, we emulate it by analyzing the input files to the shared library and exporting all the symbols therein.

Not exporting all symbols is actually desirable, as it can improve loading speed, reduces the likelihood of symbol conflicts and can improve intra extension library function call performance. It also makes the non-windows builds more similar to windows builds.

Additionally, with meson implementing the export-all-symbols behavior for windows, turns out to be more verbose than desirable.

This patch adds support for hiding symbols by default and, to counteract that, explicit symbol visibility annotation for compilers that support attribute((visibility("default"))) and -fvisibility=hidden. That is expected to be most, if not all, compilers except msvc (for which we already support explicit symbol export annotations).

Now that extension library symbols are explicitly exported, we don't need to export all symbols on windows anymore, hence remove that behavior from src/tools/msvc. The supporting code can't be removed, as we still need to export all symbols from the main postgres binary.

Author: Andres Freund andres@anarazel.de Author: Tom Lane tgl@sss.pgh.pa.us Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de

Fix configure executable permissions.

I do not [yet] understand how, but my prior commit (089480c0770) accidentally removed the exec bit from configure. I'll try to figure that out later, for now re-add to unbreak the buildfarm.

Mark all symbols exported from extension libraries PGDLLEXPORT.

This is in preparation for defaulting to -fvisibility=hidden in extensions, instead of relying on all symbols in extensions to be exported.

This should have been committed before 089480c0770, but something in my commit scripts went wrong.

Author: Andres Freund andres@anarazel.de Reviewed-By: Tom Lane tgl@sss.pgh.pa.us Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de

Convert macros to static inline functions (tupmacs.h)

Reviewed-by: Amul Sul sulamul@gmail.com Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com

Add another SQL/JSON error code

A code comment said that the standard does not define a number for ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE, but this was fixed in a later draft version of the standard, so use that number now.

pg_upgrade: Adjust quoting style in message to match guidelines

Reinstate tests accidentally removed by e3fcca0d0d

Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also removed a couple unrelated tests from stats.sql. Reinstate those tests.

Reported-by: Peter Eisentraut

Deal with paths containing \ and spaces in basebackup_to_shell tests

As $gzip is embedded in postgresql.conf \ needs to be escaped, otherwise guc.c will take it as a string escape. Similarly, if "$gzip" contains spaces, the prior incantation will fail. Both of these are common on windows.

Reviewed-by: Peter Eisentraut peter.eisentraut@enterprisedb.com Discussion: https://postgr.es/m/ce1b6eb3-5736-6f38-9775-b7020128b8d8@enterprisedb.com Backpatch: 15-, where the test was added in 027fa0fd726

psql: Output dir and dependency generation for sql_help

This is in preparation for building postgres with meson / ninja.

When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option.

To deal with dependencies to the variable set of input files to this script, add an option to generate a dependency file (which meson / ninja can consume).

Reviewed-by: Peter Eisentraut peter.eisentraut@enterprisedb.com Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

ecpg: Output dir, source dir, stamp file argument for preproc/*.pl

This is in preparation for building postgres with meson / ninja.

When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option.

Add option to generate a timestamp for check_rules.pl, so that proper dependencies on it having been run can be generated.

Reviewed-by: Peter Eisentraut peter.eisentraut@enterprisedb.com Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

Move snowball_create.sql creation into perl file

This is in preparation for building postgres with meson / ninja.

We already have duplicated code for this between the make and msvc builds. Adding a third copy seems like a bad plan, thus move the generation into a perl script.

As we don't want to rely on perl being available for builds from tarballs, generate the file during distprep.

Author: Peter Eisentraut peter@eisentraut.org Author: Andres Freund andres@anarazel.de Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

Add output path arg in generate-lwlocknames.pl

This is in preparation for building postgres with meson / ninja.

When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option.

Reviewed-by: Peter Eisentraut peter.eisentraut@enterprisedb.com Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

Add output file argument to generate-errcodes.pl

This is in preparation for building postgres with meson / ninja.

meson's 'capture' (redirecting stdout to a file) is a bit slower than programs redirecting output themselves (mostly due to a python wrapper necessary for windows). That doesn't matter for most things, but errcodes.h is a dependency of nearly everything, making it a bit faster seem worthwhile.

Medium term it might also be worth avoiding writing errcodes.h if its contents didn't actually change, to avoid unnecessary recompilations.

Reviewed-by: Peter Eisentraut peter.eisentraut@enterprisedb.com Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

Add output directory argument to generate-unicode_norm_table.pl

This is in preparation for building postgres with meson / ninja.

When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place.

Author: Andres Freund andres@anarazel.de Author: Peter Eisentraut peter@eisentraut.org Author: Nazir Bilal Yavuz byavuz81@gmail.com Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

Add output directory option to gen_node_support.pl

This is in preparation for building postgres with meson / ninja.

When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option.

Reviewed-by: Peter Eisentraut peter.eisentraut@enterprisedb.com Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

Refactor dtrace postprocessing make rules

This is in preparation for building postgres with meson / ninja.

Move the dtrace postprocessing sed commands into a separate file so that it can be shared by meson. Also split the rule into two for proper dependency declaration.

Reviewed-by: Andres Freund andres@anarazel.de Author: Peter Eisentraut peter@eisentraut.org Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com

ecpg: use our instead of my in parse.pl to fix perlcritic complaint

In db0a272d123 I used open(our $something, ...), which perlcritic doesn't like. It looks like the warning is due to perlcritic knowing about 'my' but not 'our' when checking for bareword file handles.

However, it's clearly unnecessary to use "our" here, change it to "my".

Via buildfarm member crake and discussion with Tom Lane.

Discussion: https://postgr.es/m/20220718215042.sl3hivoupdb7lkwv@awork3.anarazel.de

Improve perl style in ecpg's parser-construction scripts.

parse.pl and check_rules.pl used "no warnings 'uninitialized'", which doesn't seem like it measures up to current project standards. Removing that shows that it was hiding various places that accessed off the end of an array, which are easily protected by minor logic adjustments. There's no change in the script results.

While here, improve the Makefile rule that invokes these scripts. It neglected to depend on check_rules.pl, so that editing that file didn't result in re-running the check; and it ran check_rules.pl after building preproc.y, so that if check_rules.pl did fail the next "make" attempt would just bypass it. check_rules.pl failures are sufficiently un-heard-of that I don't feel a need to back-patch this.

Discussion: https://postgr.es/m/838180.1658181982@sss.pgh.pa.us

windows: msvc: Define STDIN/OUT/ERR_FILENO.

Because they are not available we've used _fileno(stdin) in some places, but that doesn't reliably work, because stdin might be closed. This is the prerequisite of the subsequent commit, fixing a failure introduced in 76e38b37a5.

Author: Andres Freund andres@anarazel.de Reported-By: Sandeep Thakkar sandeep.thakkar@enterprisedb.com Message-Id: 20220520164558.ozb7lm6unakqzezi@alap3.anarazel.de (on pgsql-packagers) Backpatch: 15-, where 76e38b37a5 came in

Use STDOUT/STDERR_FILENO in most of syslogger.

This fixes problems on windows when logging collector is used in a service, failing with: FATAL: could not redirect stderr: Bad file descriptor

This is triggered by 76e38b37a5. The problem is that STDOUT/STDERR_FILENO aren't defined on windows, which lead us to use _fileno(stdout) etc, but that doesn't work if stdout/stderr are closed.

Author: Andres Freund andres@anarazel.de Reported-By: Sandeep Thakkar sandeep.thakkar@enterprisedb.com Message-Id: 20220520164558.ozb7lm6unakqzezi@alap3.anarazel.de (on pgsql-packagers) Backpatch: 15-, where 76e38b37a5 came in

Created at 4 days ago

Fix pg_regress to print the correct postmaster address on Windows.

pg_regress reported "Unix socket" as the default location whenever HAVE_UNIX_SOCKETS is defined. However, that's not been accurate on Windows since 8f3ec75de. Update this logic to match what libpq actually does now.

This is just cosmetic, but still it's potentially misleading. Back-patch to v13 where 8f3ec75de came in.

Discussion: https://postgr.es/m/3894060.1646415641@sss.pgh.pa.us

Introduce PG_TEST_TIMEOUT_DEFAULT for TAP suite non-elapsing timeouts.

Slow hosts may avoid load-induced, spurious failures by setting environment variable PG_TEST_TIMEOUT_DEFAULT to some number of seconds greater than 180. Developers may see faster failures by setting that environment variable to some lesser number of seconds. In tests, write $PostgreSQL::Test::Utils::timeout_default wherever the convention has been to write 180. This change raises the default for some briefer timeouts. Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/20220218052842.GA3627003@rfd.leadboat.com

doc: Add ALTER/DROP ROUTINE to the event trigger matrix

ALTER ROUTINE triggers the events ddl_command_start and ddl_command_end, and DROP ROUTINE triggers sql_drop, ddl_command_start and ddl_command_end, but this was not mention on the matrix table.

Reported-by: Leslie Lemaire Discussion: https://postgr.es/m/164647533363.646.5802968483136493025@wrigleys.postgresql.org Backpatch-through: 11

Restore the previous semantics of get_constraint_index().

Commit 8b069ef5d changed this function to look at pg_constraint.conindid rather than searching pg_depend. That was a good performance improvement, but it failed to preserve the exact semantics. The old code would only return an index that was "owned by" (internally dependent on) the specified constraint, whereas the new code will also return indexes that are just referenced by foreign key constraints. This confuses ALTER TABLE, which was implicitly expecting the previous semantics, into failing with errors like ERROR: relation 146621 has multiple clustered indexes or ERROR: "pk_attbl" is not an index for table "atref"

We can fix this without reverting the performance improvement by adding a contype check in get_constraint_index(). Another way could be to make ALTER TABLE check it, but I'm worried that extension code could also have subtle dependencies on the old semantics.

Tom Lane and Japin Li, per bug #17409 from Holly Roberts. Back-patch to v14 where the error crept in.

Discussion: https://postgr.es/m/17409-52871dda8b5741cb@postgresql.org

Back-patch LLVM 14 API changes.

Since LLVM 14 has stopped changing and is about to be released, back-patch the following changes from the master branch:

e6a7600202105919bffd62b3dfd941f4a94e082b 807fee1a39de6bb8184082012e643951abb9ad1d a56e7b66010f330782243de9e25ac2a6596be0e1

Back-patch to 11, where LLVM JIT support came in.

Wake up for latches in CheckpointWriteDelay().

The checkpointer shouldn't ignore its latch. Other backends may be waiting for it to drain the request queue. Hopefully real systems don't have a full queue often, but the condition is reached easily when shared_buffers is small.

This involves defining a new wait event, which will appear in the pg_stat_activity view often due to spread checkpoints.

Back-patch only to 14. Even though the problem exists in earlier branches too, it's hard to hit there. In 14 we stopped using signal handlers for latches on Linux, *BSD and macOS, which were previously hiding this problem by interrupting the sleep (though not reliably, as the signal could arrive before the sleep begins; precisely the problem latches address).

Reported-by: Andres Freund andres@anarazel.de Reviewed-by: Andres Freund andres@anarazel.de Discussion: https://postgr.es/m/20220226213942.nb7uvb2pamyu26dj%40alap3.anarazel.de

pageinspect: Fix handling of page sizes and AM types

This commit fixes a set of issues related to the use of the SQL functions in this module when the caller is able to pass down raw page data as input argument:

  • The page size check was fuzzy in a couple of places, sometimes looking after only a sub-range, but what we are looking for is an exact match on BLCKSZ. After considering a few options here, I have settled down to do a generalization of get_page_from_raw(). Most of the SQL functions already used that, and this is not strictly required if not accessing an 8-byte-wide value from a raw page, but this feels safer in the long run for alignment-picky environment, particularly if a code path begins to access such values. This also reduces the number of strings that need to be translated.
  • The BRIN function brin_page_items() uses a Relation but it did not check the access method of the opened index, potentially leading to crashes. All the other functions in need of a Relation already did that.
  • Some code paths could fail on elog(), but we should to use ereport() for failures that can be triggered by the user.

Tests are added to stress all the cases that are fixed as of this commit, with some junk raw pages (\set VERBOSITY ensures that this works across all page sizes) and unexpected index types when functions open relations.

Author: Michael Paquier, Justin Prysby Discussion: https://postgr.es/m/20220218030020.GA1137@telsasoft.com Backpatch-through: 10

Fix waiting in RegisterSyncRequest().

If we run out of space in the checkpointer sync request queue (which is hopefully rare on real systems, but common with very small buffer pool), we wait for it to drain. While waiting, we should report that as a wait event so that users know what is going on, and also handle postmaster death, since otherwise the loop might never terminate if the checkpointer has exited.

Back-patch to 12. Although the problem exists in earlier releases too, the code is structured differently before 12 so I haven't gone any further for now, in the absence of field complaints.

Reported-by: Andres Freund andres@anarazel.de Reviewed-by: Andres Freund andres@anarazel.de Discussion: https://postgr.es/m/20220226213942.nb7uvb2pamyu26dj%40alap3.anarazel.de

Fix documentation typo in commit 5e6368b4.

Back-patch to 14.

pageinspect: Fix memory context allocation of page in brin_revmap_data()

This caused the function to fail, as the aligned copy of the raw page given by the function caller was not saved in the correct memory context, which needs to be multi_call_memory_ctx in this case.

Issue introduced by 076f4d9.

Per buildfarm members sifika, mylodon and longfin. I have reproduced that locally with macos.

Discussion: https://postgr.es/m/YjFPOtfCW6yLXUeM@paquier.xyz Backpatch-through: 10

Fix race between DROP TABLESPACE and checkpointing.

Commands like ALTER TABLE SET TABLESPACE may leave files for the next checkpoint to clean up. If such files are not removed by the time DROP TABLESPACE is called, we request a checkpoint so that they are deleted. However, there is presently a window before checkpoint start where new unlink requests won't be scheduled until the following checkpoint. This means that the checkpoint forced by DROP TABLESPACE might not remove the files we expect it to remove, and the following ERROR will be emitted:

ERROR:  tablespace "mytblspc" is not empty

To fix, add a call to AbsorbSyncRequests() just before advancing the unlink cycle counter. This ensures that any unlink requests forwarded prior to checkpoint start (i.e., when ckpt_started is incremented) will be processed by the current checkpoint. Since AbsorbSyncRequests() performs memory allocations, it cannot be called within a critical section, so we also need to move SyncPreCheckpoint() to before CreateCheckPoint()'s critical section.

This is an old bug, so back-patch to all supported versions.

Author: Nathan Bossart nathandbossart@gmail.com Reported-by: Nathan Bossart nathandbossart@gmail.com Reviewed-by: Thomas Munro thomas.munro@gmail.com Reviewed-by: Andres Freund andres@anarazel.de Discussion: https://postgr.es/m/20220215235845.GA2665318%40nathanxps13

Fix default signature length for gist_ltree_ops

911e702077 implemented operator class parameters including the signature length in ltree. Previously, the signature length for gist_ltree_ops was 8. Because of bug 911e702077 the default signature length for gist_ltree_ops became 28 for ltree 1.1 (where options method is NOT provided) and 8 for ltree 1.2 (where options method is provided). This commit changes the default signature length for ltree 1.1 to 8.

Existing gist_ltree_ops indexes might be corrupted in various scenarios. Thus, we have to recommend reindexing all the gist_ltree_ops indexes after the upgrade.

Reported-by: Victor Yegorov Reviewed-by: Tomas Vondra, Tom Lane, Andres Freund, Nikita Glukhov Reviewed-by: Andrew Dunstan Author: Tomas Vondra, Alexander Korotkov Discussion: https://postgr.es/m/17406-71e02820ae79bb40%40postgresql.org Discussion: https://postgr.es/m/d80e0a55-6c3e-5b26-53e3-3c4f973f737c%40enterprisedb.com

Fix publish_as_relid with multiple publications

Commit 83fd4532a7 allowed publishing of changes via ancestors, for publications defined with publish_via_partition_root. But the way the ancestor was determined in get_rel_sync_entry() was incorrect, simply updating the same variable. So with multiple publications, replicating different ancestors, the outcome depended on the order of publications in the list - the value from the last loop was used, even if it wasn't the top-most ancestor.

This is a probably rare situation, as in most cases publications do not overlap, so each partition has exactly one candidate ancestor to replicate as and there's no ambiguity.

Fixed by tracking the "ancestor level" for each publication, and picking the top-most ancestor. Adds a test case, verifying the correct ancestor is used for publishing the changes and that this does not depend on order of publications in the list.

Older releases have another bug in this loop - once all actions are replicated, the loop is terminated, on the assumption that inspecting additional publications is unecessary. But that misses the fact that those additional applications may replicate different ancestors.

Fixed by removal of this break condition. We might still terminate the loop in some cases (e.g. when replicating all actions and the ancestor is the partition root).

Backpatch to 13, where publish_via_partition_root was introduced.

Initial report and fix by me, test added by Hou zj. Reviews and improvements by Amit Kapila.

Author: Tomas Vondra, Hou zj, Amit Kapila Reviewed-by: Amit Kapila, Hou zj Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com

Revert applying column aliases to the output of whole-row Vars.

In commit bf7ca1587, I had the bright idea that we could make the result of a whole-row Var (that is, foo.*) track any column aliases that had been applied to the FROM entry the Var refers to. However, that's not terribly logically consistent, because now the output of the Var is no longer of the named composite type that the Var claims to emit. bf7ca1587 tried to handle that by changing the output tuple values to be labeled with a blessed RECORD type, but that's really pretty disastrous: we can wind up storing such tuples onto disk, whereupon they're not readable by other sessions.

The only practical fix I can see is to give up on what bf7ca1587 tried to do, and say that the column names of tuples produced by a whole-row Var are always those of the underlying named composite type, query aliases or no. While this introduces some inconsistencies, it removes others, so it's not that awful in the abstract. What is kind of awful is to make such a behavioral change in a back-patched bug fix. But corrupt data is worse, so back-patched it will be.

(A workaround available to anyone who's unhappy about this is to introduce an extra level of sub-SELECT, so that the whole-row Var is referring to the sub-SELECT's output and not to a named table type. Then the Var is of type RECORD to begin with and there's no issue.)

Per report from Miles Delahunty. The faulty commit dates to 9.5, so back-patch to all supported branches.

Discussion: https://postgr.es/m/2950001.1638729947@sss.pgh.pa.us

Fix incorrect xmlschema output for types timetz and timestamptz.

The output of table_to_xmlschema() and allied functions includes a regex describing valid values for these types ... but the regex was itself invalid, as it failed to escape a literal "+" sign.

Report and fix by Renan Soares Lopes. Back-patch to all supported branches.

Discussion: https://postgr.es/m/7f6fabaa-3f8f-49ab-89ca-59fbfe633105@me.com

doc: Mention SET TABLESPACE clause for ALTER MATERIALIZED VIEW

This command flavor is supported, but there was nothing in the documentation about it.

Author: Yugo Nagata Discussion: https://postgr.es/m/20220316133337.5dc9740abfa24c25ec9f67f5@sraoss.co.jp Backpatch-through: 10

Doc: fix our example systemd script.

The example used "TimeoutSec=0", but systemd's documented way to get the desired effect is "TimeoutSec=infinity".

Discussion: https://postgr.es/m/164770078557.670.5467111518383664377@wrigleys.postgresql.org

Fix risk of deadlock failure while dropping a partitioned index.

DROP INDEX needs to lock the index's table before the index itself, else it will deadlock against ordinary queries that acquire the relation locks in that order. This is correctly mechanized for plain indexes by RangeVarCallbackForDropRelation; but in the case of a partitioned index, we neglected to lock the child tables in advance of locking the child indexes. We can fix that by traversing the inheritance tree and acquiring the needed locks in RemoveRelations, after we have acquired our locks on the parent partitioned table and index.

While at it, do some refactoring to eliminate confusion between the actual and expected relkind in RangeVarCallbackForDropRelation. We can save a couple of syscache lookups too, by having that function pass back info that RemoveRelations will need.

Back-patch to v11 where partitioned indexes were added.

Jimmy Yih, Gaurab Dey, Tom Lane

Discussion: https://postgr.es/m/BYAPR05MB645402330042E17D91A70C12BD5F9@BYAPR05MB6454.namprd05.prod.outlook.com

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes, in particular with respect to processing of the argument expressions, which are not to be evaluated at runtime. A few places hadn't gotten that memo, notably including subselect.c's processing of outer-level aggregates. This resulted in assertion failures or wrong plans for cases in which a GROUPING() construct references an outer aggregation level.

Also fix missing special cases for GroupingFunc in cost_qual_eval (resulting in wrong cost estimates for GROUPING(), although it's not clear that that would affect plan shapes in practice) and in ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen. Back-patch to all supported branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Fix failures in SSL tests caused by out-of-tree keys and certificates

This issue is environment-sensitive, where the SSL tests could fail in various way by feeding on defaults provided by sslcert, sslkey, sslrootkey, sslrootcert, sslcrl and sslcrldir coming from a local setup, as of ~/.postgresql/ by default. Horiguchi-san has reported two failures, but more advanced testing from me (aka inclusion of garbage SSL configuration in ~/.postgresql/ for all the configuration parameters) has showed dozens of failures that can be triggered in the whole test suite.

History has showed that we are not good when it comes to address such issues, fixing them locally like in dd87799, and such problems keep appearing. This commit strengthens the entire test suite to put an end to this set of problems by embedding invalid default values in all the connection strings used in the tests. The invalid values are prefixed in each connection string, relying on the follow-up values passed in the connection string to enforce any invalid value previously set. Note that two tests related to CRLs are required to fail with certain pre-set configurations, but we can rely on enforcing an empty value instead after the invalid set of values.

Reported-by: Kyotaro Horiguchi Reviewed-by: Andrew Dunstan, Daniel Gustafsson, Kyotaro Horiguchi Discussion: https://postgr.es/m/20220316.163658.1122740600489097632.horikyota.ntt@gmail.com backpatch-through: 10

Created at 4 days ago
Created at 2 weeks ago
Created at 1 month ago
opened issue
image + url block doesn't render correctly in linked reference

What happened?

image + url block doesn't render correctly in linked reference, demo in the screenshots

Reproduce the Bug

  1. create a new page test0
  2. make a block with content
    ![](https://github.githubassets.com/favicons/favicon.svg){:height 16, :width 16}[logseq/logseq: A privacy-first, open-source platform for knowledge management and collaboration. Desktop app download link: https://github.com/logseq/logseq/releases, roadmap: https://trello.com/b/8txSM12G/roadmap](https://github.com/logseq/logseq)
        #test1
    
  3. go to page test1
  4. notice that the block is not rendered correctly in test1 page1's linked reference
  5. after clicking the linked reference, it starts rendering correctly.

Expected Behavior

the linked reference should render the block correctly without having to click the block

Screenshots

gif

Desktop Platform Information

MacOS 12.4, App 0.8.8

Mobile Platform Information

No response

Additional Context

No response

Created at 1 month ago

setup fzf, zoxide via zinit

Created at 2 months ago