Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcb00b7f

Browse files
committed
I'm in TODO mood today ...
* Document/trigger/rule so changes to pg_shadow recreate pg_pwdI did it with a trigger and it seems to work like a charm. The functionthat already updates the file for create and alter user has been made abuilt-in "SQL" function and a trigger is created at initdb time.Comments around the pg_pwd updating function seem to be worried aboutthisroutine being called concurrently, but I really don't see a reason toworry about this. Verify for yourself. I guess we never had a systemtrigger before, so treat this with care, and feel free to adjust thenomenclature as well.--Peter Eisentraut Sernanders väg 10:115
1 parent11023eb commitcb00b7f

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

‎doc/TODO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ MISC
204204
* Do autocommit so always in a transaction block(?)
205205
* Show location of syntax error in query [yacc]
206206
* Redesign the function call interface to handle NULLs better [function]
207-
* Document/trigger/rule so changes to pg_shadow recreate pg_pwd [pg_shadow]
207+
*-Document/trigger/rule so changes to pg_shadow recreate pg_pwd [pg_shadow]
208208
* Missing optimizer selectivities for date, r-tree, etc. [optimizer]
209209
* -Overhaul mdmgr/smgr to fix double unlinking and double opens, cleanup
210210
* Overhaul bufmgr/lockmgr/transaction manager

‎src/backend/commands/user.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: user.c,v 1.40 1999/11/30 04:29:56 momjian Exp $
8+
* $Id: user.c,v 1.41 1999/12/12 05:57:28 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -43,8 +43,13 @@ static void CheckPgUserAclNotNull(void);
4343
* pg_shadow is the standard way to do that.
4444
*---------------------------------------------------------------------
4545
*/
46-
staticvoid
47-
UpdatePgPwdFile(void)
46+
47+
/* This is the old name. Now uses a lower case name to be able to call this
48+
from SQL. */
49+
#defineUpdatePgPwdFile() update_pg_pwd()
50+
51+
void
52+
update_pg_pwd()
4853
{
4954
char*filename,
5055
*tempname;
@@ -71,7 +76,7 @@ UpdatePgPwdFile(void)
7176
false,/* from */
7277
false,/* pipe */
7378
tempname,/* filename */
74-
CRYPT_PWD_FILE_SEPCHAR,/* delim */
79+
CRYPT_PWD_FILE_SEPSTR,/* delim */
7580
0077);/* fileumask */
7681
/*
7782
* And rename the temp file to its final name, deleting the old pg_pwd.

‎src/bin/initdb/initdb.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#
2727
#
2828
# IDENTIFICATION
29-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.63 1999/12/09 04:36:57 momjian Exp $
29+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.64 1999/12/12 05:57:30 momjian Exp $
3030
#
3131
#-------------------------------------------------------------------------
3232

@@ -412,6 +412,10 @@ echo
412412

413413
PGSQL_OPT="-o /dev/null -O -F -Q -D$PGDATA"
414414

415+
# Create a trigger so that direct updates to pg_shadow will be written
416+
# to the flat password file pg_pwd
417+
echo"CREATE TRIGGER pg_sync_pg_pwd AFTER INSERT OR UPDATE OR DELETE ON pg_shadow FOR EACH ROW EXECUTE PROCEDURE update_pg_pwd()"| postgres$PGSQL_OPT template1> /dev/null
418+
415419
# Create the initial pg_pwd (flat-file copy of pg_shadow)
416420
echo"COPY pg_shadow TO '$PGDATA/pg_pwd' USING DELIMITERS '\\t'"| \
417421
postgres$PGSQL_OPT template1> /dev/null

‎src/include/catalog/pg_proc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_proc.h,v 1.108 1999/12/01 18:03:26 momjian Exp $
9+
* $Id: pg_proc.h,v 1.109 1999/12/12 05:57:36 momjian Exp $
1010
*
1111
* NOTES
1212
* The script catalog/genbki.sh reads this file and generates .bki
@@ -93,6 +93,8 @@ typedef FormData_pg_proc *Form_pg_proc;
9393
/* keep the following ordered by OID so that later changes can be made easier */
9494

9595
/* OIDS 1 - 99 */
96+
DATA(insertOID=12 (update_pg_pwdPGUID11ftf0f0""10000100update_pg_pwd- ));
97+
DESCR("update pg_pwd file");
9698

9799
DATA(insertOID=1242 (boolinPGUID11ftt1f16"0"10000100boolin- ));
98100
DESCR("(internal)");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp