1997-11-06 05:38:25 +08:00
|
|
|
/*
|
|
|
|
* utils.c --
|
|
|
|
*
|
|
|
|
* This file defines various Postgres utility functions.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1996, Massimo Dal Zotto <dz@cs.unitn.it>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "postgres.h"
|
|
|
|
#include "utils/palloc.h"
|
|
|
|
|
|
|
|
#include "misc_utils.h"
|
|
|
|
|
1998-02-26 12:46:47 +08:00
|
|
|
extern int ExecutorLimit(int limit);
|
1997-11-06 05:38:25 +08:00
|
|
|
extern void Async_Unlisten(char *relname, int pid);
|
|
|
|
|
|
|
|
int
|
|
|
|
query_limit(int limit)
|
|
|
|
{
|
1998-02-26 12:46:47 +08:00
|
|
|
return ExecutorLimit(limit);
|
1997-11-06 05:38:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
backend_pid()
|
|
|
|
{
|
1998-02-26 12:46:47 +08:00
|
|
|
return getpid();
|
1997-11-06 05:38:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
unlisten(char *relname)
|
|
|
|
{
|
1998-02-26 12:46:47 +08:00
|
|
|
Async_Unlisten(relname, getpid());
|
|
|
|
return 0;
|
1997-11-06 05:38:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
max(int x, int y)
|
|
|
|
{
|
1998-02-26 12:46:47 +08:00
|
|
|
return ((x > y) ? x : y);
|
1997-11-06 05:38:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
min(int x, int y)
|
|
|
|
{
|
1998-02-26 12:46:47 +08:00
|
|
|
return ((x < y) ? x : y);
|
1997-11-06 05:38:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* end of file */
|