postgresql/Sanity/libecpg/testecpg-interval.pgc
Ondřej Sloup f5317bdf87 Fix permission issue with tmp folder
Due to permission issues with creating a temporary folder, the two custom tests from PostgreSQL documentation failed as they could not write their results to the temp log file. The issue was resolved by changing the owner of the temporary folder while creating it.
While looking for the issue, the varDump command was commented out as it was not needed and not even found. Also, two tests taken from the documentation were edited; therefore, the slight changes which were made to them to work in our scenario can be highlighted.
2022-08-11 12:20:48 +02:00

26 lines
631 B
Text

// Taken from https://www.postgresql.org/docs/14/ecpg-variables.html
#include <stdio.h>
#include <stdlib.h>
#include <pgtypes_interval.h>
int
main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
interval *in;
EXEC SQL END DECLARE SECTION;
// Add "USER postgres;"
EXEC SQL CONNECT TO testdb USER postgres;
// EXEC SQL SELECT pg_catalog.set_config('search_path', '', false); EXEC SQL COMMIT;
in = PGTYPESinterval_new();
EXEC SQL SELECT '1 min'::interval INTO :in;
printf("interval = %s\n", PGTYPESinterval_to_asc(in));
PGTYPESinterval_free(in);
EXEC SQL COMMIT;
EXEC SQL DISCONNECT ALL;
return 0;
}