Index: doc/src/sgml/func.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v retrieving revision 1.280 diff -c -c -r1.280 func.sgml *** doc/src/sgml/func.sgml 13 Aug 2005 19:02:32 -0000 1.280 --- doc/src/sgml/func.sgml 15 Aug 2005 22:35:59 -0000 *************** *** 9414,9425 **** pg_stat_file() returns a record containing the file ! length, last accessed timestamp, last modified timestamp, ! creation timestamp, and a boolean indicating if it is a directory. ! Typical usages include: SELECT * FROM pg_stat_file('filename'); ! SELECT (pg_stat_file('filename')).mtime; --- 9414,9426 ---- pg_stat_file() returns a record containing the file ! size, last accessed timestamp, last modified timestamp, ! last file status change timestamp (Unix platforms only), ! file creation timestamp (Win32 only), and a boolean indicating ! if it is a directory. Typical usages include: SELECT * FROM pg_stat_file('filename'); ! SELECT (pg_stat_file('filename')).modification; Index: src/backend/catalog/system_views.sql =================================================================== RCS file: /cvsroot/pgsql/src/backend/catalog/system_views.sql,v retrieving revision 1.20 diff -c -c -r1.20 system_views.sql *** src/backend/catalog/system_views.sql 15 Aug 2005 16:25:17 -0000 1.20 --- src/backend/catalog/system_views.sql 15 Aug 2005 22:35:59 -0000 *************** *** 346,353 **** 'timestamptz', 'timestamptz', 'timestamptz', 'bool'], ! proargmodes = ARRAY['i'::"char", 'o', 'o', 'o', 'o', 'o'], ! proargnames = ARRAY['filename'::text, ! 'length', 'atime', 'mtime', 'ctime','isdir'] WHERE oid = 'pg_stat_file(text)'::regprocedure; --- 346,354 ---- 'timestamptz', 'timestamptz', 'timestamptz', + 'timestamptz', 'bool'], ! proargmodes = ARRAY['i'::"char", 'o', 'o', 'o', 'o', 'o', 'o'], ! proargnames = ARRAY['filename'::text, 'size', 'access', 'modification', ! 'change', 'creation', 'isdir'] WHERE oid = 'pg_stat_file(text)'::regprocedure; Index: src/backend/utils/adt/genfile.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/adt/genfile.c,v retrieving revision 1.4 diff -c -c -r1.4 genfile.c *** src/backend/utils/adt/genfile.c 13 Aug 2005 19:02:34 -0000 1.4 --- src/backend/utils/adt/genfile.c 15 Aug 2005 22:36:00 -0000 *************** *** 154,161 **** text *filename_t = PG_GETARG_TEXT_P(0); char *filename; struct stat fst; ! Datum values[5]; ! bool isnull[5]; HeapTuple tuple; TupleDesc tupdesc; --- 154,161 ---- text *filename_t = PG_GETARG_TEXT_P(0); char *filename; struct stat fst; ! Datum values[6]; ! bool isnull[6]; HeapTuple tuple; TupleDesc tupdesc; *************** *** 175,200 **** * This record type had better match the output parameters declared * for me in pg_proc.h (actually, in system_views.sql at the moment). */ ! tupdesc = CreateTemplateTupleDesc(5, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, ! "length", INT8OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, ! "atime", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 3, ! "mtime", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 4, ! "ctime", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 5, "isdir", BOOLOID, -1, 0); BlessTupleDesc(tupdesc); values[0] = Int64GetDatum((int64) fst.st_size); values[1] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_atime)); values[2] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_mtime)); values[3] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_ctime)); ! values[4] = BoolGetDatum(fst.st_mode & S_IFDIR); ! ! memset(isnull, false, sizeof(isnull)); tuple = heap_form_tuple(tupdesc, values, isnull); --- 175,209 ---- * This record type had better match the output parameters declared * for me in pg_proc.h (actually, in system_views.sql at the moment). */ ! tupdesc = CreateTemplateTupleDesc(6, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, ! "size", INT8OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, ! "access", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 3, ! "modification", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 4, ! "change", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 5, + "creation", TIMESTAMPTZOID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 6, "isdir", BOOLOID, -1, 0); BlessTupleDesc(tupdesc); + memset(isnull, false, sizeof(isnull)); + values[0] = Int64GetDatum((int64) fst.st_size); values[1] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_atime)); values[2] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_mtime)); + /* Unix has file status change time, while Win32 has creation time */ + #if !defined(WIN32) && !defined(__CYGWIN__) values[3] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_ctime)); ! isnull[4] = true; ! #else ! isnull[3] = true; ! values[4] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_ctime)); ! #endif ! values[5] = BoolGetDatum(fst.st_mode & S_IFDIR); tuple = heap_form_tuple(tupdesc, values, isnull); Index: src/include/catalog/catversion.h =================================================================== RCS file: /cvsroot/pgsql/src/include/catalog/catversion.h,v retrieving revision 1.299 diff -c -c -r1.299 catversion.h *** src/include/catalog/catversion.h 15 Aug 2005 16:25:18 -0000 1.299 --- src/include/catalog/catversion.h 15 Aug 2005 22:36:01 -0000 *************** *** 53,58 **** */ /* yyyymmddN */ ! #define CATALOG_VERSION_NO 200508151 #endif --- 53,58 ---- */ /* yyyymmddN */ ! #define CATALOG_VERSION_NO 200508152 #endif