From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: pgsql: Add function to import operating system collations
Date: Thu, 19 Jan 2017 10:26:14 -0500
Message-ID: <dfd34b03-911b-adad-57f9-42833bb15610@2ndquadrant.com> (raw)
In-Reply-To: <13753.1484830411@sss.pgh.pa.us>
References: <E1cTrLM-0008E8-6K@gemulon.postgresql.org>
<CAA4eK1+z2ZwNvXMsfK-nTD5HeZqm6pLoXR7mXH_dVcbOoNYwDA@mail.gmail.com>
<13753.1484830411@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
On 1/19/17 7:53 AM, Tom Lane wrote:
> Hm. I see that the patch randomly changed the way that the collation
> owner is generated ... looks like it no longer works for mixed-case
> usernames. Perhaps follow this model instead:
>
> if (superuser_password)
> PG_CMD_PRINTF2("ALTER USER \"%s\" WITH PASSWORD E'%s';\n\n",
> username, escape_quotes(superuser_password));
>
> although TBH that doesn't look too darn safe either. I wonder how
> initdb has gotten along so far with no quote_ident() function.
We could just use the numeric value, like in the attached patch.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committersAttachments:initdb-bootstrap-superuser-fix.patch (text/x-patch, 1012B) downloaddiff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.cindex eb1be100c8..75d3d6f5f6 100644--- a/src/bin/initdb/initdb.c+++ b/src/bin/initdb/initdb.c@@ -61,6 +61,7 @@
#endif
#include "catalog/catalog.h"
+#include "catalog/pg_authid.h"
#include "common/file_utils.h"
#include "common/restricted_token.h"
#include "common/username.h"
@@ -1617,7 +1618,7 @@ setup_collation(FILE *cmdfd)
PG_CMD_PUTS("SELECT pg_import_system_collations(if_not_exists => false, schema => 'pg_catalog');\n\n");
/* Add an SQL-standard name */
- PG_CMD_PRINTF2("INSERT INTO pg_collation (collname, collnamespace, collowner, collencoding, collcollate, collctype) VALUES ('ucs_basic', 'pg_catalog'::regnamespace, '%s'::regrole, %d, 'C', 'C');\n\n", escape_quotes(username), PG_UTF8);+ PG_CMD_PRINTF2("INSERT INTO pg_collation (collname, collnamespace, collowner, collencoding, collcollate, collctype) VALUES ('ucs_basic', 'pg_catalog'::regnamespace, %u, %d, 'C', 'C');\n\n", BOOTSTRAP_SUPERUSERID, PG_UTF8);
}
/*
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us, amit.kapila16@gmail.com
Subject: Re: pgsql: Add function to import operating system collations
In-Reply-To: <dfd34b03-911b-adad-57f9-42833bb15610@2ndquadrant.com>
References: <E1cTrLM-0008E8-6K@gemulon.postgresql.org> <CAA4eK1+z2ZwNvXMsfK-nTD5HeZqm6pLoXR7mXH_dVcbOoNYwDA@mail.gmail.com> <13753.1484830411@sss.pgh.pa.us> <dfd34b03-911b-adad-57f9-42833bb15610@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox