public inbox for [email protected]
help / color / mirror / Atom feed[PATCH 2/3] Allow composite types in bootstrap
6+ messages / 4 participants
[nested] [flat]
* [PATCH 2/3] Allow composite types in bootstrap
@ 2020-11-17 15:28 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Justin Pryzby @ 2020-11-17 15:28 UTC (permalink / raw)
---
src/backend/bootstrap/bootstrap.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 18eb62ca47..e4fc75ab84 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -916,6 +916,7 @@ gettype(char *type)
{
if (Typ != NIL)
{
+ static bool did_reread PG_USED_FOR_ASSERTS_ONLY = false; /* Already reread pg_types */
ListCell *lc;
foreach (lc, Typ)
@@ -927,6 +928,33 @@ gettype(char *type)
return app->am_oid;
}
}
+
+ /*
+ * The type wasn't known; check again to handle composite
+ * types, added since first populating the array.
+ */
+
+ /*
+ * Once all the types are populated and we handled composite
+ * types, shouldn't need to do that again.
+ */
+ Assert(!did_reread);
+ did_reread = true;
+
+ list_free_deep(Typ);
+ Typ = NULL;
+ populate_typ_array();
+
+ /* Need to avoid infinite recursion... */
+ foreach (lc, Typ)
+ {
+ struct typmap *app = lfirst(lc);
+ if (strncmp(NameStr(app->am_typ.typname), type, NAMEDATALEN) == 0)
+ {
+ Ap = app;
+ return app->am_oid;
+ }
+ }
}
else
{
--
2.26.2
--------------76B8D0DC8AE327D516738282
Content-Type: text/x-patch; charset=UTF-8;
name="0003-Extended-statistics-on-expressions-20210108.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0003-Extended-statistics-on-expressions-20210108.patch"
^ permalink raw reply [nested|flat] 6+ messages in thread
* Fix a typo in pg_rotate_logfile
@ 2024-02-12 20:32 Bharath Rupireddy <[email protected]>
2024-02-12 20:39 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Bharath Rupireddy @ 2024-02-12 20:32 UTC (permalink / raw)
To: PostgreSQL Hackers <[email protected]>
Hi,
I happened to notice a typo in pg_rotate_logfile in ipc/signalfuncs.c
- the hint message wrongly mentions that pg_logfile_rotate is part of
the core; which is actually not. pg_logfile_rotate is an adminpack's
1.0 SQL function dropped in 2.0. The core defines pg_rotate_logfile
SQL function instead, so use that. Here's a patch to fix the typo.
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Attachments:
[application/x-patch] v1-0001-Fix-a-typo-in-pg_rotate_logfile.patch (897B, ../../CALj2ACUmL5TraYBUBqDZBi1C+Re8_=SekqGYqYprj_W8wygQ8w@mail.gmail.com/2-v1-0001-Fix-a-typo-in-pg_rotate_logfile.patch)
download | inline diff:
From 18854ba341d892750fc75b9988ba107fe44e7c63 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <[email protected]>
Date: Mon, 12 Feb 2024 13:30:31 +0000
Subject: [PATCH v1] Fix a typo in pg_rotate_logfile
---
src/backend/storage/ipc/signalfuncs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/storage/ipc/signalfuncs.c b/src/backend/storage/ipc/signalfuncs.c
index 81d1a59659..c05a2af48b 100644
--- a/src/backend/storage/ipc/signalfuncs.c
+++ b/src/backend/storage/ipc/signalfuncs.c
@@ -284,7 +284,7 @@ pg_rotate_logfile(PG_FUNCTION_ARGS)
errmsg("must be superuser to rotate log files with adminpack 1.0"),
/* translator: %s is a SQL function name */
errhint("Consider using %s, which is part of core, instead.",
- "pg_logfile_rotate()")));
+ "pg_rotate_logfile()")));
if (!Logging_collector)
{
--
2.34.1
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Fix a typo in pg_rotate_logfile
2024-02-12 20:32 Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
@ 2024-02-12 20:39 ` Daniel Gustafsson <[email protected]>
2024-02-12 20:46 ` Re: Fix a typo in pg_rotate_logfile Nathan Bossart <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Gustafsson @ 2024-02-12 20:39 UTC (permalink / raw)
To: Bharath Rupireddy <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>
> On 12 Feb 2024, at 21:32, Bharath Rupireddy <[email protected]> wrote:
> I happened to notice a typo in pg_rotate_logfile in ipc/signalfuncs.c
> - the hint message wrongly mentions that pg_logfile_rotate is part of
> the core; which is actually not. pg_logfile_rotate is an adminpack's
> 1.0 SQL function dropped in 2.0. The core defines pg_rotate_logfile
> SQL function instead, so use that. Here's a patch to fix the typo.
Nice catch! This needs to be backpatched all the way down to 12 as that
function wen't away a long time ago (it was marked as deprecated all the way
back in 9.1).
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Fix a typo in pg_rotate_logfile
2024-02-12 20:32 Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
2024-02-12 20:39 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
@ 2024-02-12 20:46 ` Nathan Bossart <[email protected]>
2024-02-12 20:59 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Nathan Bossart @ 2024-02-12 20:46 UTC (permalink / raw)
To: Daniel Gustafsson <[email protected]>; +Cc: Bharath Rupireddy <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Feb 12, 2024 at 09:39:06PM +0100, Daniel Gustafsson wrote:
>> On 12 Feb 2024, at 21:32, Bharath Rupireddy <[email protected]> wrote:
>> I happened to notice a typo in pg_rotate_logfile in ipc/signalfuncs.c
>> - the hint message wrongly mentions that pg_logfile_rotate is part of
>> the core; which is actually not. pg_logfile_rotate is an adminpack's
>> 1.0 SQL function dropped in 2.0. The core defines pg_rotate_logfile
>> SQL function instead, so use that. Here's a patch to fix the typo.
>
> Nice catch! This needs to be backpatched all the way down to 12 as that
> function wen't away a long time ago (it was marked as deprecated all the way
> back in 9.1).
This is a bit strange because, with this patch, the HINT suggests using a
function with the same name as the one it lives in. IIUC this is because
adminpack's pg_logfile_rotate() uses pg_rotate_logfile(), while core's
pg_rotate_logfile() uses pg_rotate_logfile_v2(). I suppose trying to
rename these might be more trouble than it's worth at this point, though...
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Fix a typo in pg_rotate_logfile
2024-02-12 20:32 Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
2024-02-12 20:39 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
2024-02-12 20:46 ` Re: Fix a typo in pg_rotate_logfile Nathan Bossart <[email protected]>
@ 2024-02-12 20:59 ` Daniel Gustafsson <[email protected]>
2024-02-12 21:31 ` Re: Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Gustafsson @ 2024-02-12 20:59 UTC (permalink / raw)
To: Nathan Bossart <[email protected]>; +Cc: Bharath Rupireddy <[email protected]>; PostgreSQL Hackers <[email protected]>
> On 12 Feb 2024, at 21:46, Nathan Bossart <[email protected]> wrote:
>
> On Mon, Feb 12, 2024 at 09:39:06PM +0100, Daniel Gustafsson wrote:
>>> On 12 Feb 2024, at 21:32, Bharath Rupireddy <[email protected]> wrote:
>>> I happened to notice a typo in pg_rotate_logfile in ipc/signalfuncs.c
>>> - the hint message wrongly mentions that pg_logfile_rotate is part of
>>> the core; which is actually not. pg_logfile_rotate is an adminpack's
>>> 1.0 SQL function dropped in 2.0. The core defines pg_rotate_logfile
>>> SQL function instead, so use that. Here's a patch to fix the typo.
>>
>> Nice catch! This needs to be backpatched all the way down to 12 as that
>> function wen't away a long time ago (it was marked as deprecated all the way
>> back in 9.1).
>
> This is a bit strange because, with this patch, the HINT suggests using a
> function with the same name as the one it lives in. IIUC this is because
> adminpack's pg_logfile_rotate() uses pg_rotate_logfile(), while core's
> pg_rotate_logfile() uses pg_rotate_logfile_v2(). I suppose trying to
> rename these might be more trouble than it's worth at this point, though...
Yeah, I doubt that's worth the churn.
On that note though, we might want to consider just dropping it altogether in
v17 (while fixing the incorrect hint in backbranches)? I can't imagine
adminpack 1.0 being in heavy use today, and skimming pgAdmin code it seems it's
only used in pgAdmin3 and not 4. Maybe it's time to simply drop old code?
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Fix a typo in pg_rotate_logfile
2024-02-12 20:32 Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
2024-02-12 20:39 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
2024-02-12 20:46 ` Re: Fix a typo in pg_rotate_logfile Nathan Bossart <[email protected]>
2024-02-12 20:59 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
@ 2024-02-12 21:31 ` Bharath Rupireddy <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Bharath Rupireddy @ 2024-02-12 21:31 UTC (permalink / raw)
To: Daniel Gustafsson <[email protected]>; [email protected]; +Cc: Nathan Bossart <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, Feb 13, 2024 at 2:29 AM Daniel Gustafsson <[email protected]> wrote:
>
> On that note though, we might want to consider just dropping it altogether in
> v17 (while fixing the incorrect hint in backbranches)? I can't imagine
> adminpack 1.0 being in heavy use today, and skimming pgAdmin code it seems it's
> only used in pgAdmin3 and not 4. Maybe it's time to simply drop old code?
https://codesearch.debian.net/search?q=pg_logfile_rotate&literal=1
shows no users for it though. There's pgadmin3 using it
https://github.com/search?q=repo%3Apgadmin-org%2Fpgadmin3%20pg_logfile_rotate&type=code,
however the repo is archived. Surprisingly, core has to maintain the
old code needed for adminpack 1.0 - pg_rotate_logfile_old SQL function
and pg_rotate_logfile function in signalfuncs.c. These things could
have been moved to adminpack.c back then and pointed CREATE FUNCTION
pg_catalog.pg_logfile_rotate() to use it from adminpack.c. If we
decide to remove adminpack 1.0 version completely, the 1.0 functions
pg_file_read, pg_file_length and pg_logfile_rotate will also go away
making adminpack code simpler.
Having said that, it's good to hear from others, preferably from
pgadmin developers - added Dave Page ([email protected]) in here for
inputs.
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2024-02-12 21:31 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 15:28 [PATCH 2/3] Allow composite types in bootstrap Justin Pryzby <[email protected]>
2024-02-12 20:32 Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
2024-02-12 20:39 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
2024-02-12 20:46 ` Re: Fix a typo in pg_rotate_logfile Nathan Bossart <[email protected]>
2024-02-12 20:59 ` Re: Fix a typo in pg_rotate_logfile Daniel Gustafsson <[email protected]>
2024-02-12 21:31 ` Re: Fix a typo in pg_rotate_logfile Bharath Rupireddy <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox