+02/05/2010 Cédric Villemain <cedric@villemain.org>
+
+ * 0.4.1 - use AllocateFile instead of fopen
+ - call PG_GETARG* earlier
+ - remove useless global counter
+ - add error handler in pgfadv_snapshot()
+ - errno to catch the last segment
+
01/05/2010 Cédric Villemain <cedric@villemain.org>
* 0.4.0 - fix test is not temp table
pgfincore_fctx *fctx;
Datum result;
char pathname[MAXPGPATH];
- bool isnull;
/* stuff done only on the first call of the function */
if (SRF_IS_FIRSTCALL())
* When we have work with all segment of the current relation, test success
* We exit from the SRF
*/
- if (DatumGetInt64(GetAttributeByName((HeapTupleHeader)result, "block_disk", &isnull)) == 0
- || isnull )
+ if (errno == ENOENT )
{
relation_close(fctx->rel, AccessShareLock);
pfree(fctx);
free(vec);
munmap(pa, st.st_size);
close(fd);
-
return HeapTupleGetDatum(tuple); /* return filename, block_disk, block_mem, group_mem */
error:
values[4] = Int64GetDatum(false);
memset(nulls, 0, sizeof(nulls));
tuple = heap_form_tuple(tupdesc, values, nulls);
+ errno = ENOENT;
return (HeapTupleGetDatum(tuple));
}
values[3] = Int64GetDatum(false);
memset(nulls, 0, sizeof(nulls));
tuple = heap_form_tuple(tupdesc, values, nulls);
+ errno = ENOENT;
return (HeapTupleGetDatum(tuple));
}
if (file == NULL)
{
if (errno == ENOENT)
- return; /* ignore not-found error */
+ return block_mem; /* ignore not-found error */
goto error;
}
FreeFile(file);
/* If possible, throw away the bogus file; ignore any error */
unlink(path);
+ return block_mem;
}