mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-21 21:43:22 +02:00
TO_DATE() and PgSQL extension FROM_CHAR(). TO_CHAR() routine allow formating text output with a datetime values: SELECT TO_CHAR('now'::datetime, '"Now is: "HH24:MI:SS'); to_char ---------------- Now is: 21:04:10 FROM_CHAR() routine allow convert text to a datetime: SELECT FROM_CHAR('September 1999 10:20:30', 'FMMonth YYYY HH:MI:SS'); from_char ----------------------------- Wed Sep 01 10:20:30 1999 CEST TO_DATE() is equal with FROM_CHAR(), but output a Date only: SELECT TO_DATE('September 1999 10:20:30', 'FMMonth YYYY HH:MI:SS'); to_date ---------- 09-01-1999 In attache is compressed dir for the contrib. All is prepared, but I'am not sure if Makefile is good (probably yes). Comments & suggestions ? Thomas, thank you for your good advices. Karel ------------------------------------------------------------------------------ Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/
72 lines
1.2 KiB
Makefile
72 lines
1.2 KiB
Makefile
#-------------------------------------------------------------------------
|
|
#
|
|
# Makefile --
|
|
#
|
|
# Makefile for TO-FROM_CHAR module.
|
|
#
|
|
#-------------------------------------------------------------------------
|
|
|
|
PGDIR = ../..
|
|
SRCDIR = $(PGDIR)/src
|
|
|
|
include $(SRCDIR)/Makefile.global
|
|
|
|
INCLUDE_OPT = -I ./ \
|
|
-I $(SRCDIR)/ \
|
|
-I $(SRCDIR)/include \
|
|
-I $(SRCDIR)/port/$(PORTNAME)
|
|
|
|
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
|
|
|
|
MODNAME = to-from_char
|
|
|
|
SQLDEFS = $(MODNAME).sql
|
|
|
|
MODULE = $(MODNAME)$(DLSUFFIX)
|
|
|
|
MODDIR = $(LIBDIR)/modules
|
|
|
|
SQLDIR = $(LIBDIR)/sql
|
|
|
|
all: module sql
|
|
|
|
module: $(MODULE)
|
|
|
|
sql: $(SQLDEFS)
|
|
|
|
install: $(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
|
|
cp -p $(MODULE) $(MODDIR)/
|
|
strip $(MODDIR)/$(MODULE)
|
|
cp -p $(SQLDEFS) $(SQLDIR)/
|
|
|
|
install-doc:
|
|
if [ -d "$(DOCDIR)" ]; then \
|
|
cp -p *.doc $(DOCDIR); \
|
|
else \
|
|
cp -p *.doc $(SQLDIR); \
|
|
fi
|
|
|
|
$(MODDIR):
|
|
mkdir -p $@
|
|
|
|
$(SQLDIR):
|
|
mkdir -p $@
|
|
|
|
%.sql: %.sql.in
|
|
sed "s|MODULE_PATHNAME|$(MODDIR)/$(MODULE)|" < $< > $@
|
|
|
|
.SUFFIXES: $(DLSUFFIX)
|
|
|
|
%$(DLSUFFIX): %.c
|
|
$(CC) $(CFLAGS) -shared -o $@ $<
|
|
|
|
depend dep:
|
|
$(CC) -MM $(INCLUDE_OPT) *.c >depend
|
|
|
|
clean:
|
|
rm -f *~ $(MODULE) $(MODNAME).sql
|
|
|
|
ifeq (depend,$(wildcard depend))
|
|
include depend
|
|
endif
|