23
23
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
24
24
* Portions Copyright (c) 1994, Regents of the University of California
25
25
*
26
- * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.25 2007/04/06 04:21:43 tgl Exp $
26
+ * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.26 2007/06/12 17:16:52 tgl Exp $
27
27
*
28
28
*-------------------------------------------------------------------------
29
29
*/
@@ -441,7 +441,10 @@ write_auth_file(Relation rel_authid, Relation rel_authmem)
441
441
* We can't use heap_getattr() here because during startup we will not
442
442
* have any tupdesc for pg_authid. Fortunately it's not too hard to
443
443
* work around this. rolpassword is the first possibly-null field so
444
- * we can compute its offset directly.
444
+ * we can compute its offset directly. Note that this only works
445
+ * reliably because the preceding field (rolconnlimit) is int4, and
446
+ * therefore rolpassword is always 4-byte-aligned, and will be at
447
+ * the same offset no matter whether it uses 1-byte or 4-byte header.
445
448
*/
446
449
tp = (char * ) tup + tup -> t_hoff ;
447
450
off = offsetof(FormData_pg_authid , rolpassword );
@@ -460,6 +463,10 @@ write_auth_file(Relation rel_authid, Relation rel_authmem)
460
463
/*
461
464
* The password probably shouldn't ever be out-of-line toasted; if
462
465
* it is, ignore it, since we can't handle that in startup mode.
466
+ *
467
+ * It is entirely likely that it's 1-byte format not 4-byte, and
468
+ * theoretically possible that it's compressed inline, but textout
469
+ * should be able to handle those cases even in startup mode.
463
470
*/
464
471
if (VARATT_IS_EXTERNAL (DatumGetPointer (datum )))
465
472
auth_info [curr_role ].rolpassword = pstrdup ("" );
0 commit comments