--- /dev/null
+# Makefile for contrib code
+#
+# The following subdirs don't have a Makefile:
+#
+# apache_logging
+# linux
+# mSQL-interface
+# noupdate
+# unixdate
+#
+# The following subdirs give make errors:
+#
+# earthdistance
+# findoidjoins
+# isbn_issn
+# os2client
+# pginterface
+
+all:
+ for dir in *; do \
+ if [ -e $$dir/Makefile ]; then \
+ $(MAKE) -C $$dir; \
+ fi; \
+ done
+
+install:
+ for dir in *; do \
+ if [ -e $$dir/Makefile ]; then \
+ $(MAKE) -C $$dir $@ ; \
+ fi; \
+ done
+
+clean:
+ for dir in *; do \
+ if [ -e $$dir/Makefile ]; then \
+ $(MAKE) -C $$dir $@ ; \
+ fi; \
+ done || exit 0
+
+distclean:
+ for dir in *; do \
+ if [ -e $$dir/Makefile ]; then \
+ $(MAKE) -C $$dir $@ ; \
+ fi; \
+ done || exit 0
#-------------------------------------------------------------------------
#
-# Makefile--
-# Makefile for array iterator functions.
+# Makefile --
+#
+# Makefile for array iterator module.
#
#-------------------------------------------------------------------------
MODNAME = array_iterator
+SQLDEFS = $(MODNAME).sql
+
MODULE = $(MODNAME)$(DLSUFFIX)
MODDIR = $(LIBDIR)/modules
module: $(MODULE)
-sql: $(MODNAME).sql
+sql: $(SQLDEFS)
-install: $(MODULE) $(MODDIR) $(SQLDIR)
+install: $(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
cp -p $(MODULE) $(MODDIR)/
strip $(MODDIR)/$(MODULE)
- cp -p $(MODNAME).sql $(SQLDIR)/
+ cp -p $(SQLDEFS) $(SQLDIR)/
$(MODDIR):
mkdir -p $@
{
return array_iterator((Oid) 25, /* text */
(Oid) 67, /* texteq */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 25, /* text */
(Oid) 67, /* texteq */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 25, /* text */
(Oid) 1254, /* textregexeq */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 25, /* text */
(Oid) 1254, /* textregexeq */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
/*
- * Iterator functions for type _char16. Note that the regexp
+ * Iterator functions for type _varchar. Note that the regexp
* operators take the second argument of type text.
*/
int32
-array_char16eq(ArrayType *array, char *value)
+array_varchareq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1275, /* char16eq */
- 0, /* logical or */
+ return array_iterator((Oid) 20, /* varchar */
+ (Oid) 1070, /* varchareq */
+ 0, /* logical or */
array, (Datum) value);
}
int32
-array_all_char16eq(ArrayType *array, char *value)
+array_all_varchareq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1275, /* char16eq */
- 1, /* logical and */
+ return array_iterator((Oid) 20, /* varchar */
+ (Oid) 1070, /* varchareq */
+ 1, /* logical and */
array, (Datum) value);
}
int32
-array_char16regexeq(ArrayType *array, char *value)
+array_varcharregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1288, /* char16regexeq */
- 0, /* logical or */
+ return array_iterator((Oid) 20, /* varchar */
+ (Oid) 1254, /* textregexeq */
+ 0, /* logical or */
+ array, (Datum) value);
+}
+
+int32
+array_all_varcharregexeq(ArrayType *array, char *value)
+{
+ return array_iterator((Oid) 20, /* varchar */
+ (Oid) 1254, /* textregexeq */
+ 1, /* logical and */
+ array, (Datum) value);
+}
+
+/*
+ * Iterator functions for type _bpchar. Note that the regexp
+ * operators take the second argument of type text.
+ */
+
+int32
+array_bpchareq(ArrayType *array, char *value)
+{
+ return array_iterator((Oid) 20, /* bpchar */
+ (Oid) 1048, /* bpchareq */
+ 0, /* logical or */
+ array, (Datum) value);
+}
+
+int32
+array_all_bpchareq(ArrayType *array, char *value)
+{
+ return array_iterator((Oid) 20, /* bpchar */
+ (Oid) 1048, /* bpchareq */
+ 1, /* logical and */
+ array, (Datum) value);
+}
+
+int32
+array_bpcharregexeq(ArrayType *array, char *value)
+{
+ return array_iterator((Oid) 20, /* bpchar */
+ (Oid) 1254, /* textregexeq */
+ 0, /* logical or */
array, (Datum) value);
}
int32
-array_all_char16regexeq(ArrayType *array, char *value)
+array_all_bpcharregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1288, /* char16regexeq */
- 1, /* logical and */
+ return array_iterator((Oid) 20, /* bpchar */
+ (Oid) 1254, /* textregexeq */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 65, /* int4eq */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 65, /* int4eq */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 144, /* int4ne */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 144, /* int4ne */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 147, /* int4gt */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 147, /* int4gt */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 150, /* int4ge */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 150, /* int4ge */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 66, /* int4lt */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 66, /* int4lt */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 149, /* int4le */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 23, /* int4 */
(Oid) 149, /* int4le */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
/* new tobias gabele 1999 */
-
int32
array_oideq(ArrayType *array, Oid value)
{
return array_iterator((Oid) 26, /* oid */
(Oid) 184, /* oideq */
- 0, /* logical or */
+ 0, /* logical or */
array, (Datum) value);
}
{
return array_iterator((Oid) 26, /* int4 */
(Oid) 185, /* oidne */
- 1, /* logical and */
+ 1, /* logical and */
array, (Datum) value);
}
-
-
-
-
-
-
/* end of file */
+
+/*
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
#define ARRAY_ITERATOR_H
static int32 array_iterator(Oid elemtype, Oid proc, int and,
- ArrayType *array, Datum value);
+ ArrayType *array, Datum value);
+
int32 array_texteq(ArrayType *array, char *value);
int32 array_all_texteq(ArrayType *array, char *value);
int32 array_textregexeq(ArrayType *array, char *value);
int32 array_all_textregexeq(ArrayType *array, char *value);
-int32 array_char16eq(ArrayType *array, char *value);
-int32 array_all_char16eq(ArrayType *array, char *value);
-int32 array_char16regexeq(ArrayType *array, char *value);
-int32 array_all_char16regexeq(ArrayType *array, char *value);
+
+int32 array_varchareq(ArrayType *array, char *value);
+int32 array_all_varchareq(ArrayType *array, char *value);
+int32 array_varcharregexeq(ArrayType *array, char *value);
+int32 array_all_varcharregexeq(ArrayType *array, char *value);
+
+int32 array_bpchareq(ArrayType *array, char *value);
+int32 array_all_bpchareq(ArrayType *array, char *value);
+int32 array_bpcharregexeq(ArrayType *array, char *value);
+int32 array_all_bpcharregexeq(ArrayType *array, char *value);
+
int32 array_int4eq(ArrayType *array, int4 value);
int32 array_all_int4eq(ArrayType *array, int4 value);
int32 array_int4ne(ArrayType *array, int4 value);
int32 array_all_int4lt(ArrayType *array, int4 value);
int32 array_int4le(ArrayType *array, int4 value);
int32 array_all_int4le(ArrayType *array, int4 value);
-int32 array_oideq(ArrayType *array, Oid value);
-int32 array_all_oidne(ArrayType *array, Oid value);
+int32 array_oideq(ArrayType *array, Oid value);
+int32 array_all_oidne(ArrayType *array, Oid value);
#endif
+
+/*
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
procedure=array_all_textregexeq);
--- define the array operators *=, **=, *~ and **~ for type _char16
+-- define the array operators *=, **=, *~ and **~ for type _varchar
--
-create function array_char16eq(_char16, char16) returns bool
+-- NOTE: "varchar" is also a reserved word and must be quoted.
+--
+create function array_varchareq(_varchar, varchar) returns bool
as 'MODULE_PATHNAME'
language 'c';
-create function array_all_char16eq(_char16, char16) returns bool
+create function array_all_varchareq(_varchar, varchar) returns bool
as 'MODULE_PATHNAME'
language 'c';
-create function array_char16regexeq(_char16, text) returns bool
+create function array_varcharregexeq(_varchar, varchar) returns bool
as 'MODULE_PATHNAME'
language 'c';
-create function array_all_char16regexeq(_char16, text) returns bool
+create function array_all_varcharregexeq(_varchar, varchar) returns bool
as 'MODULE_PATHNAME'
language 'c';
create operator *= (
- leftarg=_char16,
- rightarg=char16,
- procedure=array_char16eq);
+ leftarg=_varchar,
+ rightarg="varchar",
+ procedure=array_varchareq);
create operator **= (
- leftarg=_char16,
- rightarg=char16,
- procedure=array_all_char16eq);
+ leftarg=_varchar,
+ rightarg="varchar",
+ procedure=array_all_varchareq);
create operator *~ (
- leftarg=_char16,
- rightarg=text,
- procedure=array_char16regexeq);
+ leftarg=_varchar,
+ rightarg="varchar",
+ procedure=array_varcharregexeq);
create operator **~ (
- leftarg=_char16,
- rightarg=text,
- procedure=array_all_char16regexeq);
+ leftarg=_varchar,
+ rightarg="varchar",
+ procedure=array_all_varcharregexeq);
+
+
+-- define the array operators *=, **=, *~ and **~ for type _bpchar
+--
+create function array_bpchareq(_bpchar, bpchar) returns bool
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function array_all_bpchareq(_bpchar, bpchar) returns bool
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function array_bpcharregexeq(_bpchar, bpchar) returns bool
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function array_all_bpcharregexeq(_bpchar, bpchar) returns bool
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create operator *= (
+ leftarg=_bpchar,
+ rightarg=bpchar,
+ procedure=array_bpchareq);
+
+create operator **= (
+ leftarg=_bpchar,
+ rightarg=bpchar,
+ procedure=array_all_bpchareq);
+
+create operator *~ (
+ leftarg=_bpchar,
+ rightarg=bpchar,
+ procedure=array_bpcharregexeq);
+
+create operator **~ (
+ leftarg=_bpchar,
+ rightarg=bpchar,
+ procedure=array_all_bpcharregexeq);
-- define the array operators *=, **=, *> and **> for type _int4
procedure=array_all_oidne);
-
-- end of file
#-------------------------------------------------------------------------
#
-# Makefile--
-# Makefile for new date/time functions.
+# Makefile --
+#
+# Makefile for new datetime module.
#
#-------------------------------------------------------------------------
MODNAME = datetime_functions
+SQLDEFS = $(MODNAME).sql
+
MODULE = $(MODNAME)$(DLSUFFIX)
MODDIR = $(LIBDIR)/modules
module: $(MODULE)
-sql: $(MODNAME).sql
+sql: $(SQLDEFS)
-install: $(MODULE) $(MODDIR) $(SQLDIR)
+install: $(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
cp -p $(MODULE) $(MODDIR)/
strip $(MODDIR)/$(MODULE)
- cp -p $(MODNAME).sql $(SQLDIR)/
+ cp -p $(SQLDEFS) $(SQLDIR)/
$(MODDIR):
mkdir -p $@
/* Constant to replace calls to date2j(2000,1,1) */
#define JDATE_2000 2451545
+/*
+ * decode_24h_time()
+ *
+ * Decode time string 00:00:00 through 24:00:00.
+ */
+static int
+decode_24h_time(char *str, struct tm *tm, double *fsec)
+{
+ char *cp;
+
+ tm->tm_hour = strtol(str, &cp, 10);
+ if (*cp != ':')
+ return -1;
+ str = cp + 1;
+ tm->tm_min = strtol(str, &cp, 10);
+ if (*cp == '\0')
+ {
+ tm->tm_sec = 0;
+ *fsec = 0;
+ }
+ else if (*cp != ':')
+ {
+ return -1;
+ }
+ else
+ {
+ str = cp + 1;
+ tm->tm_sec = strtol(str, &cp, 10);
+ if (*cp == '\0')
+ *fsec = 0;
+ else if (*cp == '.')
+ {
+ str = cp;
+ *fsec = strtod(str, &cp);
+ if (cp == str)
+ return -1;
+ }
+ else
+ return -1;
+ }
+
+ /* do a sanity check */
+ if ( (tm->tm_hour < 0) || (tm->tm_hour > 24)
+ || (tm->tm_min < 0) || (tm->tm_min > 59)
+ || (tm->tm_sec < 0) || (tm->tm_sec > 59)
+ || (fsec < 0) )
+ return -1;
+
+ return 0;
+}
+
/*
* A modified version of time_in which allows the value 24:00:00 for
* time and converts it to TimeADT data type forcing seconds to 0.
- * This can be Useful if you need to handle TimeADT values limited
+ * This can be useful if you need to handle TimeADT values limited
* to hh:mm like in timetables.
*/
struct tm tt,
*tm = &tt;
- int nf;
- char lowstr[MAXDATELEN + 1];
- char *field[MAXDATEFIELDS];
- int dtype;
- int ftype[MAXDATEFIELDS];
-
if (!PointerIsValid(str))
elog(ERROR, "Bad (null) time external representation", NULL);
- if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
- || (DecodeTimeOnly(field, ftype, nf, &dtype, tm, &fsec) != 0))
+ if (decode_24h_time(str, tm, &fsec) != 0)
elog(ERROR, "Bad time external representation '%s'", str);
- if (tm->tm_hour < 0 || tm->tm_hour > 24 ||
- (tm->tm_hour == 24 && (tm->tm_min != 0 || tm->tm_sec != 0 || fsec != 0)))
+ if ((tm->tm_hour < 0) || (tm->tm_hour > 24)
+ || ((tm->tm_hour == 24)
+ && ((tm->tm_min != 0) || (tm->tm_sec != 0) || (fsec != 0.0))))
{
elog(ERROR,
- "time_in: hour must be limited to values 0 through 24:00 "
+ "Time must be limited to values 00:00:00 through 24:00:00 "
"in \"%s\"",
str);
}
- if ((tm->tm_min < 0) || (tm->tm_min > 59))
- elog(ERROR, "Minute must be limited to values 0 through 59 in '%s'", str);
- if ((tm->tm_sec < 0) || ((tm->tm_sec + fsec) >= 60))
- elog(ERROR, "Second must be limited to values 0 through < 60 in '%s'",
- str);
time = palloc(sizeof(TimeADT));
-
*time = ((((tm->tm_hour * 60) + tm->tm_min) * 60));
return (time);
/* end of file */
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/
DateADT currentdate(void);
#endif
+
+/*
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
--
create function hhmm_mode() returns text
as 'update pg_type set typinput =''hhmm_in'' where typname=''time'';
- update pg_type set typoutput=''hhmm_out'' where typname=''time''
- select ''hhmm_mode''::text'
+ update pg_type set typoutput=''hhmm_out'' where typname=''time'';
+ select ''hhmm_mode''::text;'
language 'sql';
create function time_mode() returns text
as 'update pg_type set typinput =''time_in'' where typname=''time'';
- update pg_type set typoutput=''time_out'' where typname=''time''
- select ''time_mode''::text'
+ update pg_type set typoutput=''time_out'' where typname=''time'';
+ select ''time_mode''::text;'
language 'sql';
-- Use these to do the updates manually
MODNAME = misc_utils
+SQLDEFS = $(MODNAME).sql
+
MODULE = $(MODNAME)$(DLSUFFIX)
MODDIR = $(LIBDIR)/modules
module: $(MODULE)
-sql: $(MODNAME).sql
+sql: $(SQLDEFS)
-install: $(MODULE) $(MODDIR) $(SQLDIR)
+install: $(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
cp -p $(MODULE) $(MODDIR)/
strip $(MODDIR)/$(MODULE)
- cp -p $(MODNAME).sql $(SQLDIR)/
+ cp -p $(SQLDEFS) $(SQLDIR)/
$(MODDIR):
mkdir -p $@
*/
#include
+#include
+#include
+#include
#include "postgres.h"
+#include "access/heapam.h"
+#include "access/htup.h"
+#include "access/relscan.h"
+#include "access/skey.h"
+#include "access/tupdesc.h"
+#include "catalog/catname.h"
+#include "catalog/pg_listener.h"
+#include "storage/lmgr.h"
+#include "utils/fmgr.h"
#include "utils/palloc.h"
+#include "utils/rel.h"
+#include "utils/tqual.h"
#include "misc_utils.h"
-#include "assert_test.h"
+
+#define MIN(x,y) ((x)<=(y) ? (x) : (y))
extern int ExecutorLimit(int limit);
extern void Async_Unlisten(char *relname, int pid);
#ifdef ASSERT_CHECKING_TEST
extern int assertEnable(int val);
-
#endif
int
return ((x < y) ? x : y);
}
+/*
+ * Return the number of active listeners on a relation name.
+ */
+int
+active_listeners(text *relname)
+{
+ HeapTuple lTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key;
+ Datum d;
+ bool isnull;
+ int len, pid;
+ int count = 0;
+ int ourpid = getpid();
+ char listen_name[NAMEDATALEN];
+
+ lRel = heap_openr(ListenerRelationName);
+ tdesc = RelationGetDescr(lRel);
+ LockRelation(lRel, AccessShareLock);
+
+ if (relname && (VARSIZE(relname) > VARHDRSZ)) {
+ len = MIN(VARSIZE(relname)-VARHDRSZ, NAMEDATALEN-1);
+ strncpy(listen_name, VARDATA(relname), len);
+ listen_name[len] = '\0';
+ ScanKeyEntryInitialize(&key, 0,
+ Anum_pg_listener_relname,
+ F_NAMEEQ,
+ PointerGetDatum(listen_name));
+ sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
+ } else {
+ sRel = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey)NULL);
+ }
+
+ while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
+ {
+ d = heap_getattr(lTuple, Anum_pg_listener_pid, tdesc, &isnull);
+ pid = DatumGetInt32(d);
+#ifdef HAVE_KILL
+ if ((pid == ourpid) || (kill(pid, SIGTSTP) == 0)) {
+ /* elog(NOTICE, "%d ok", pid); */
+ count++;
+ }
+#else
+ count++;
+#endif
+ }
+ heap_endscan(sRel);
+
+ UnlockRelation(lRel, AccessShareLock);
+ heap_close(lRel);
+
+ return count;
+}
+
int
assert_enable(int val)
{
{
return assertTest(val);
}
-
#endif
/* end of file */
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/
#ifdef ASSERT_CHECKING_TEST
int assert_test(int val);
-
#endif
+int active_listeners(text *relname);
#endif
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/
as 'MODULE_PATHNAME'
language 'C';
+-- Return the number of active listeners on a relation
+--
+create function active_listeners(text) returns int4
+ as 'MODULE_PATHNAME'
+ language 'C';
+
-- Enable/disable Postgres assert checking.
--
create function assert_enable(int4) returns int4
- as 'MODULE_PATHNAME'
- language 'C';
+ as 'MODULE_PATHNAME'
+ language 'C';
-- Test Postgres assert checking.
--
-- create function assert_test(int4) returns int4
--- as 'MODULE_PATHNAME'
--- language 'C';
+-- as 'MODULE_PATHNAME'
+-- language 'C';
-- end of file
#-------------------------------------------------------------------------
#
# Makefile --
+#
# Makefile for string I/O module.
#
#-------------------------------------------------------------------------
MODNAME = string_io
+SQLDEFS = $(MODNAME).sql
+
MODULE = $(MODNAME)$(DLSUFFIX)
MODDIR = $(LIBDIR)/modules
module: $(MODULE)
-sql: $(MODNAME).sql
+sql: $(SQLDEFS)
-install: $(MODULE) $(MODDIR) $(SQLDIR)
+install: $(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
cp -p $(MODULE) $(MODDIR)/
strip $(MODDIR)/$(MODULE)
- cp -p $(MODNAME).sql $(SQLDIR)/
+ cp -p $(SQLDEFS) $(SQLDIR)/
$(MODDIR):
mkdir -p $@
#define ISO8859
#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#define VALUE(char) ((char) - '0')
+#define VALUE(char) ((char) - '0')
#define DIGIT(val) ((val) + '0')
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
#ifndef ISO8859
{
return (string_input(str, 1, 0, NULL));
}
-
#endif
/* end of file */
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/
#if 0
struct varlena *c_textin(char *str);
char *c_char16in(char *str);
-
#endif
#endif
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/
update pg_type set typoutput=''c_textout'' where typname=''text'';
update pg_type set typoutput=''c_textout'' where typname=''unknown'';
update pg_type set typoutput=''c_varcharout'' where typname=''varchar'';
- select ''c_mode''::text'
+ select ''c_mode''::text;'
language 'sql';
-- Define a function which restores the standard routines for char types.
update pg_type set typoutput=''textout'' where typname=''text'';
update pg_type set typoutput=''textout'' where typname=''unknown'';
update pg_type set typoutput=''varcharout'' where typname=''varchar'';
- select ''pg_mode''::text'
+ select ''pg_mode''::text;'
language 'sql';
-- Use these to do the changes manually.
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# Makefile --
+#
+# Makefile for contrib tools.
+#
+#-------------------------------------------------------------------------
+
+PGDIR = ../..
+SRCDIR = $(PGDIR)/src
+
+include $(SRCDIR)/Makefile.global
+
+all:
+
+install:
+
+clean:
+ rm -f *~
+
+distclean: clean
--- /dev/null
+#!/bin/bash
+#
+# Add local variables to C sources files to set emacs C style to 4-space tabs.
+#
+# Usage: cd $PG_HOME && add-emacs-variables `find . -name \*.[chy] -print`
+
+for f in $*; do
+ if [ -L $f ] || grep -q '^ \* Local Variables:' $f; then
+ continue
+ fi
+ echo $f
+ touch -r $f /tmp/.add-local-variables.$$
+ cat <<- ' EOF' >> $f
+
+ /*
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ */
+ EOF
+ touch -r /tmp/.add-local-variables.$$ $f
+done
+
+rm -f /tmp/.add-local-variables.$$
+
+# end of file
--- /dev/null
+#!/bin/echo Usage: source
+#
+# Set the shell variables files, cfiles, hfiles, yfiles and sfiles with
+# the names of all .c, .h, .y, and .S files in current directory tree.
+# Define also some shell functions to grep the files. Typical usage is:
+#
+# $ cd src/
+# $ source ../contrib/tools/find-sources
+# $ gh BLCKSZ # grep BLCKSZ in .h files
+# $ gcl MAXTUPLEN # list all .c files containing MAXTUPLEN
+#
+# THIS SCRIPT MUST BE SOURCED FROM BASH.
+#
+# Copyright (C) 1999 Massimo Dal Zotto
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# Build the file lists
+dir=${1-`pwd`}/
+cfiles=`find $dir -name \*.c | sort`
+hfiles=`find $dir -name \*.h | sort`
+yfiles=`find $dir -name \*.y | sort`
+sfiles=`find $dir -name \*.S | sort`
+files="$hfiles $cfiles $yfiles $sfiles"
+
+# Define some functions to grep the files in the lists
+function g() { grep -- "$*" $files /dev/null; }
+function gc() { grep -- "$*" $cfiles /dev/null; }
+function gh() { grep -- "$*" $hfiles /dev/null; }
+function gy() { grep -- "$*" $yfiles /dev/null; }
+function gS() { grep -- "$*" $sfiles /dev/null; }
+function gl() { grep -l -- "$*" $files /dev/null; }
+function gcl() { grep -l -- "$*" $cfiles /dev/null; }
+function ghl() { grep -l -- "$*" $hfiles /dev/null; }
+function gyl() { grep -l -- "$*" $yfiles /dev/null; }
+function gSl() { grep -l -- "$*" $sfiles /dev/null; }
+
+# end of file
--- /dev/null
+#!/bin/bash
+#
+# Makes an emacs tagfile for all .[chS] and .el files in the current
+# directory tree.
+
+etags $(find . -name \*.h) 2>/dev/null || true
+etags -a $(find . -name \*.c) 2>/dev/null || true
+etags -a $(find . -name \*.S) 2>/dev/null || true
+etags -a $(find . -name \*.el) 2>/dev/null || true
#-------------------------------------------------------------------------
#
# Makefile --
+#
# Makefile for the user_locks module.
#
#-------------------------------------------------------------------------
MODNAME = user_locks
+SQLDEFS = $(MODNAME).sql
+
MODULE = $(MODNAME)$(DLSUFFIX)
MODDIR = $(LIBDIR)/modules
module: $(MODULE)
-sql: $(MODNAME).sql
+sql: $(SQLDEFS)
-install: $(MODULE) $(MODDIR) $(SQLDIR)
+install: $(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
cp -p $(MODULE) $(MODDIR)/
strip $(MODDIR)/$(MODULE)
- cp -p $(MODNAME).sql $(SQLDIR)/
+ cp -p $(SQLDEFS) $(SQLDIR)/
$(MODDIR):
mkdir -p $@
/* end of file */
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/
The generic user locks use two values, group and id, to identify a lock,
which correspond to ip_posid and ip_blkid of an ItemPointerData.
-Group is a 16 bit value while id is a 32 bit integer which can also
-contain an oid. The oid user lock function, which take an oid as argument,
+Group is a 16 bit value while id is a 32 bit integer which could also be
+an oid. The oid user lock functions, which take only an oid as argument,
use a group equal to 0.
The meaning of group and id is defined by the application. The user
#endif
/*
- * Local variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-basic-offset: 4
+ * Local Variables:
+ * tab-width: 4
+ * c-indent-level: 4
+ * c-basic-offset: 4
* End:
*/