v0-0003-change-pw.patch
text/x-patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch v0-0003
| File | + | − |
|---|---|---|
| doc/src/sgml/libpq.sgml | 0 | 0 |
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index ed88ac0..5d2f70c 100644
*** a/doc/src/sgml/libpq.sgml
--- b/doc/src/sgml/libpq.sgml
*************** char *PQencryptPasswordConn(PGconn *conn
*** 7116,7121 ****
--- 7116,7167 ----
</listitem>
</varlistentry>
+ <varlistentry id="libpq-PQchangePassword">
+ <term><function>PQchangePassword</function><indexterm><primary>PQchangePassword</primary></indexterm></term>
+
+ <listitem>
+ <para>
+ Changes a <productname>PostgreSQL</productname> password.
+ <synopsis>
+ char *PQchangePassword(PGconn *conn, const char *passwd, const char *user, const char *algorithm);
+ </synopsis>
+ This function uses <function>PQencryptPasswordConn</function>
+ to build and execute the command <literal>ALTER USER ... PASSWORD
+ '...'</literal>, thereby changing the user's password. It exists for
+ the same reason as <function>PQencryptPasswordConn</function>, but
+ is more convenient as it both builds and runs the command for you.
+ </para>
+
+ <para>
+ The <parameter>passwd</parameter> and <parameter>user</parameter> arguments
+ are the cleartext password, and the SQL name of the user it is for.
+ <parameter>algorithm</parameter> specifies the encryption algorithm
+ to use to encrypt the password. Currently supported algorithms are
+ <literal>md5</literal> and <literal>scram-sha-256</literal> (<literal>on</literal> and
+ <literal>off</literal> are also accepted as aliases for <literal>md5</literal>, for
+ compatibility with older server versions). Note that support for
+ <literal>scram-sha-256</literal> was introduced in <productname>PostgreSQL</productname>
+ version 10, and will not work correctly with older server versions. If
+ <parameter>algorithm</parameter> is <symbol>NULL</symbol>, this function will query
+ the server for the current value of the
+ <xref linkend="guc-password-encryption"/> setting. That can block, and
+ will fail if the current transaction is aborted, or if the connection
+ is busy executing another query. If you wish to use the default
+ algorithm for the server but want to avoid blocking, query
+ <varname>password_encryption</varname> yourself before calling
+ <xref linkend="libpq-PQchangePassword"/>, and pass that value as the
+ <parameter>algorithm</parameter>.
+ </para>
+
+ <para>
+ The return value is a boolean indicating <symbol>true</symbol> for success
+ or <symbol>false</symbol> for failure. On failure a suitable message is
+ stored in the connection object.
+ </para>
+
+ </listitem>
+ </varlistentry>
+
<varlistentry id="libpq-PQencryptPassword">
<term><function>PQencryptPassword</function><indexterm><primary>PQencryptPassword</primary></indexterm></term>