2006-05-31 05:34:15 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
2006-10-20 01:48:04 +08:00
|
|
|
* adminpack.c
|
2006-05-31 05:34:15 +08:00
|
|
|
*
|
|
|
|
*
|
2014-01-08 05:05:30 +08:00
|
|
|
* Copyright (c) 2002-2014, PostgreSQL Global Development Group
|
2006-10-04 08:30:14 +08:00
|
|
|
*
|
2006-05-31 05:34:15 +08:00
|
|
|
* Author: Andreas Pflug <pgadmin@pse-consulting.de>
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2010-09-21 04:08:53 +08:00
|
|
|
* contrib/adminpack/adminpack.c
|
2006-05-31 05:34:15 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "catalog/pg_type.h"
|
|
|
|
#include "funcapi.h"
|
2006-10-20 08:59:03 +08:00
|
|
|
#include "miscadmin.h"
|
2006-10-20 02:32:48 +08:00
|
|
|
#include "postmaster/syslogger.h"
|
2006-07-12 00:35:33 +08:00
|
|
|
#include "storage/fd.h"
|
2008-03-26 06:42:46 +08:00
|
|
|
#include "utils/builtins.h"
|
2006-05-31 05:34:15 +08:00
|
|
|
#include "utils/datetime.h"
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
|
|
|
#ifdef rename
|
|
|
|
#undef rename
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef unlink
|
|
|
|
#undef unlink
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PG_MODULE_MAGIC;
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
Datum pg_file_write(PG_FUNCTION_ARGS);
|
|
|
|
Datum pg_file_rename(PG_FUNCTION_ARGS);
|
|
|
|
Datum pg_file_unlink(PG_FUNCTION_ARGS);
|
|
|
|
Datum pg_logdir_ls(PG_FUNCTION_ARGS);
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
PG_FUNCTION_INFO_V1(pg_file_write);
|
|
|
|
PG_FUNCTION_INFO_V1(pg_file_rename);
|
|
|
|
PG_FUNCTION_INFO_V1(pg_file_unlink);
|
|
|
|
PG_FUNCTION_INFO_V1(pg_logdir_ls);
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
typedef struct
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
char *location;
|
|
|
|
DIR *dirdesc;
|
2006-05-31 05:34:15 +08:00
|
|
|
} directory_fctx;
|
|
|
|
|
|
|
|
/*-----------------------
|
|
|
|
* some helper functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2006-11-06 11:06:41 +08:00
|
|
|
* Convert a "text" filename argument to C string, and check it's allowable.
|
|
|
|
*
|
|
|
|
* Filename may be absolute or relative to the DataDir, but we only allow
|
|
|
|
* absolute paths that match DataDir or Log_directory.
|
2006-05-31 05:34:15 +08:00
|
|
|
*/
|
2006-10-04 08:30:14 +08:00
|
|
|
static char *
|
2006-11-06 11:06:41 +08:00
|
|
|
convert_and_check_filename(text *arg, bool logAllowed)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2008-03-26 06:42:46 +08:00
|
|
|
char *filename = text_to_cstring(arg);
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-11-06 11:06:41 +08:00
|
|
|
canonicalize_path(filename); /* filename can change length here */
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (is_absolute_path(filename))
|
|
|
|
{
|
2011-02-12 22:47:51 +08:00
|
|
|
/* Disallow '/a/b/data/..' */
|
|
|
|
if (path_contains_parent_reference(filename))
|
|
|
|
ereport(ERROR,
|
2011-04-10 23:42:00 +08:00
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
|
|
|
(errmsg("reference to parent directory (\"..\") not allowed"))));
|
|
|
|
|
2011-02-12 22:47:51 +08:00
|
|
|
/*
|
2011-04-10 23:42:00 +08:00
|
|
|
* Allow absolute paths if within DataDir or Log_directory, even
|
|
|
|
* though Log_directory might be outside DataDir.
|
2011-02-12 22:47:51 +08:00
|
|
|
*/
|
|
|
|
if (!path_is_prefix_of_path(DataDir, filename) &&
|
|
|
|
(!logAllowed || !is_absolute_path(Log_directory) ||
|
|
|
|
!path_is_prefix_of_path(Log_directory, filename)))
|
|
|
|
ereport(ERROR,
|
2011-04-10 23:42:00 +08:00
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
|
|
|
(errmsg("absolute path not allowed"))));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
2011-02-12 22:47:51 +08:00
|
|
|
else if (!path_is_relative_and_below_cwd(filename))
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
|
|
|
(errmsg("path must be in or below the current directory"))));
|
|
|
|
|
|
|
|
return filename;
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* check for superuser, bark if not.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
requireSuperuser(void)
|
|
|
|
{
|
|
|
|
if (!superuser())
|
2006-10-04 08:30:14 +08:00
|
|
|
ereport(ERROR,
|
2006-05-31 05:34:15 +08:00
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
2006-10-04 08:30:14 +08:00
|
|
|
(errmsg("only superuser may access generic file functions"))));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------
|
|
|
|
* generic file handling functions
|
|
|
|
*/
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
Datum
|
|
|
|
pg_file_write(PG_FUNCTION_ARGS)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
FILE *f;
|
|
|
|
char *filename;
|
|
|
|
text *data;
|
|
|
|
int64 count = 0;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
requireSuperuser();
|
|
|
|
|
2006-11-06 11:06:41 +08:00
|
|
|
filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false);
|
2006-05-31 05:34:15 +08:00
|
|
|
data = PG_GETARG_TEXT_P(1);
|
|
|
|
|
2006-11-06 11:06:41 +08:00
|
|
|
if (!PG_GETARG_BOOL(2))
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
struct stat fst;
|
|
|
|
|
2006-05-31 05:34:15 +08:00
|
|
|
if (stat(filename, &fst) >= 0)
|
2006-10-04 08:30:14 +08:00
|
|
|
ereport(ERROR,
|
2006-05-31 05:34:15 +08:00
|
|
|
(ERRCODE_DUPLICATE_FILE,
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("file \"%s\" exists", filename)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
f = fopen(filename, "wb");
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
else
|
2006-10-04 08:30:14 +08:00
|
|
|
f = fopen(filename, "ab");
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (!f)
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not open file \"%s\" for writing: %m",
|
|
|
|
filename)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (VARSIZE(data) != 0)
|
|
|
|
{
|
|
|
|
count = fwrite(VARDATA(data), 1, VARSIZE(data) - VARHDRSZ, f);
|
|
|
|
|
|
|
|
if (count != VARSIZE(data) - VARHDRSZ)
|
2006-10-04 08:30:14 +08:00
|
|
|
ereport(ERROR,
|
2006-05-31 05:34:15 +08:00
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not write file \"%s\": %m", filename)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
PG_RETURN_INT64(count);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
Datum
|
|
|
|
pg_file_rename(PG_FUNCTION_ARGS)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
char *fn1,
|
|
|
|
*fn2,
|
|
|
|
*fn3;
|
|
|
|
int rc;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
requireSuperuser();
|
|
|
|
|
|
|
|
if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
|
|
|
|
PG_RETURN_NULL();
|
|
|
|
|
2006-11-06 11:06:41 +08:00
|
|
|
fn1 = convert_and_check_filename(PG_GETARG_TEXT_P(0), false);
|
|
|
|
fn2 = convert_and_check_filename(PG_GETARG_TEXT_P(1), false);
|
2006-05-31 05:34:15 +08:00
|
|
|
if (PG_ARGISNULL(2))
|
2006-10-04 08:30:14 +08:00
|
|
|
fn3 = 0;
|
2006-05-31 05:34:15 +08:00
|
|
|
else
|
2006-11-06 11:06:41 +08:00
|
|
|
fn3 = convert_and_check_filename(PG_GETARG_TEXT_P(2), false);
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (access(fn1, W_OK) < 0)
|
|
|
|
{
|
|
|
|
ereport(WARNING,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("file \"%s\" is not accessible: %m", fn1)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
PG_RETURN_BOOL(false);
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fn3 && access(fn2, W_OK) < 0)
|
|
|
|
{
|
|
|
|
ereport(WARNING,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("file \"%s\" is not accessible: %m", fn2)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
PG_RETURN_BOOL(false);
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
rc = access(fn3 ? fn3 : fn2, 2);
|
|
|
|
if (rc >= 0 || errno != ENOENT)
|
|
|
|
{
|
|
|
|
ereport(ERROR,
|
|
|
|
(ERRCODE_DUPLICATE_FILE,
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("cannot rename to target file \"%s\"",
|
|
|
|
fn3 ? fn3 : fn2)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
2006-10-04 08:30:14 +08:00
|
|
|
|
2006-05-31 05:34:15 +08:00
|
|
|
if (fn3)
|
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
if (rename(fn2, fn3) != 0)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not rename \"%s\" to \"%s\": %m",
|
|
|
|
fn2, fn3)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
if (rename(fn1, fn2) != 0)
|
|
|
|
{
|
|
|
|
ereport(WARNING,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not rename \"%s\" to \"%s\": %m",
|
|
|
|
fn1, fn2)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (rename(fn3, fn2) != 0)
|
|
|
|
{
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not rename \"%s\" back to \"%s\": %m",
|
|
|
|
fn3, fn2)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ereport(ERROR,
|
|
|
|
(ERRCODE_UNDEFINED_FILE,
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("renaming \"%s\" to \"%s\" was reverted",
|
|
|
|
fn2, fn3)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rename(fn1, fn2) != 0)
|
|
|
|
{
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not rename \"%s\" to \"%s\": %m", fn1, fn2)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
PG_RETURN_BOOL(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
Datum
|
|
|
|
pg_file_unlink(PG_FUNCTION_ARGS)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
char *filename;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
requireSuperuser();
|
|
|
|
|
2006-11-06 11:06:41 +08:00
|
|
|
filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false);
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (access(filename, W_OK) < 0)
|
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
if (errno == ENOENT)
|
|
|
|
PG_RETURN_BOOL(false);
|
2006-05-31 05:34:15 +08:00
|
|
|
else
|
2006-10-04 08:30:14 +08:00
|
|
|
ereport(ERROR,
|
2006-05-31 05:34:15 +08:00
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("file \"%s\" is not accessible: %m", filename)));
|
2006-05-31 05:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (unlink(filename) < 0)
|
|
|
|
{
|
|
|
|
ereport(WARNING,
|
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not unlink file \"%s\": %m", filename)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
PG_RETURN_BOOL(false);
|
|
|
|
}
|
|
|
|
PG_RETURN_BOOL(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
Datum
|
|
|
|
pg_logdir_ls(PG_FUNCTION_ARGS)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
|
|
|
FuncCallContext *funcctx;
|
|
|
|
struct dirent *de;
|
|
|
|
directory_fctx *fctx;
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
if (!superuser())
|
2006-05-31 05:34:15 +08:00
|
|
|
ereport(ERROR,
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
|
|
|
(errmsg("only superuser can list the log directory"))));
|
2006-10-04 08:30:14 +08:00
|
|
|
|
2006-10-20 08:59:03 +08:00
|
|
|
if (strcmp(Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0)
|
2006-05-31 05:34:15 +08:00
|
|
|
ereport(ERROR,
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
|
|
|
(errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'"))));
|
|
|
|
|
|
|
|
if (SRF_IS_FIRSTCALL())
|
|
|
|
{
|
|
|
|
MemoryContext oldcontext;
|
2006-10-04 08:30:14 +08:00
|
|
|
TupleDesc tupdesc;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
funcctx = SRF_FIRSTCALL_INIT();
|
2006-05-31 05:34:15 +08:00
|
|
|
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
|
|
|
|
|
|
|
|
fctx = palloc(sizeof(directory_fctx));
|
2006-11-06 11:06:41 +08:00
|
|
|
|
2006-05-31 05:34:15 +08:00
|
|
|
tupdesc = CreateTemplateTupleDesc(2, false);
|
|
|
|
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "starttime",
|
|
|
|
TIMESTAMPOID, -1, 0);
|
|
|
|
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "filename",
|
|
|
|
TEXTOID, -1, 0);
|
|
|
|
|
|
|
|
funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);
|
2006-10-04 08:30:14 +08:00
|
|
|
|
2006-11-06 11:06:41 +08:00
|
|
|
fctx->location = pstrdup(Log_directory);
|
2006-05-31 05:34:15 +08:00
|
|
|
fctx->dirdesc = AllocateDir(fctx->location);
|
|
|
|
|
|
|
|
if (!fctx->dirdesc)
|
2006-10-04 08:30:14 +08:00
|
|
|
ereport(ERROR,
|
2006-05-31 05:34:15 +08:00
|
|
|
(errcode_for_file_access(),
|
2006-11-06 11:06:41 +08:00
|
|
|
errmsg("could not read directory \"%s\": %m",
|
|
|
|
fctx->location)));
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
funcctx->user_fctx = fctx;
|
|
|
|
MemoryContextSwitchTo(oldcontext);
|
|
|
|
}
|
|
|
|
|
2006-10-04 08:30:14 +08:00
|
|
|
funcctx = SRF_PERCALL_SETUP();
|
|
|
|
fctx = (directory_fctx *) funcctx->user_fctx;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-20 08:59:03 +08:00
|
|
|
while ((de = ReadDir(fctx->dirdesc, fctx->location)) != NULL)
|
2006-05-31 05:34:15 +08:00
|
|
|
{
|
2006-10-04 08:30:14 +08:00
|
|
|
char *values[2];
|
|
|
|
HeapTuple tuple;
|
2006-10-20 08:59:03 +08:00
|
|
|
char timestampbuf[32];
|
2006-10-04 08:30:14 +08:00
|
|
|
char *field[MAXDATEFIELDS];
|
2006-05-31 05:34:15 +08:00
|
|
|
char lowstr[MAXDATELEN + 1];
|
2006-10-04 08:30:14 +08:00
|
|
|
int dtype;
|
|
|
|
int nf,
|
|
|
|
ftype[MAXDATEFIELDS];
|
2006-05-31 05:34:15 +08:00
|
|
|
fsec_t fsec;
|
2006-10-04 08:30:14 +08:00
|
|
|
int tz = 0;
|
|
|
|
struct pg_tm date;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
/*
|
2006-10-04 08:30:14 +08:00
|
|
|
* Default format: postgresql-YYYY-MM-DD_HHMMSS.log
|
2006-05-31 05:34:15 +08:00
|
|
|
*/
|
|
|
|
if (strlen(de->d_name) != 32
|
2006-10-20 08:59:03 +08:00
|
|
|
|| strncmp(de->d_name, "postgresql-", 11) != 0
|
2006-05-31 05:34:15 +08:00
|
|
|
|| de->d_name[21] != '_'
|
2006-10-20 08:59:03 +08:00
|
|
|
|| strcmp(de->d_name + 28, ".log") != 0)
|
2006-10-04 08:30:14 +08:00
|
|
|
continue;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-20 08:59:03 +08:00
|
|
|
/* extract timestamp portion of filename */
|
|
|
|
strcpy(timestampbuf, de->d_name + 11);
|
|
|
|
timestampbuf[17] = '\0';
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-20 08:59:03 +08:00
|
|
|
/* parse and decode expected timestamp to verify it's OK format */
|
|
|
|
if (ParseDateTime(timestampbuf, lowstr, MAXDATELEN, field, ftype, MAXDATEFIELDS, &nf))
|
2006-10-04 08:30:14 +08:00
|
|
|
continue;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
if (DecodeDateTime(field, ftype, nf, &dtype, &date, &fsec, &tz))
|
2006-10-04 08:30:14 +08:00
|
|
|
continue;
|
2006-05-31 05:34:15 +08:00
|
|
|
|
2006-10-20 08:59:03 +08:00
|
|
|
/* Seems the timestamp is OK; prepare and return tuple */
|
|
|
|
|
|
|
|
values[0] = timestampbuf;
|
2013-10-13 12:09:18 +08:00
|
|
|
values[1] = psprintf("%s/%s", fctx->location, de->d_name);
|
2006-05-31 05:34:15 +08:00
|
|
|
|
|
|
|
tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
|
|
|
|
|
|
|
|
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
|
|
|
|
}
|
|
|
|
|
|
|
|
FreeDir(fctx->dirdesc);
|
|
|
|
SRF_RETURN_DONE(funcctx);
|
|
|
|
}
|