Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec5c628

Browse files
committed
Allow optional () after current_user, session_user, user, current_time,
current_timestamp, current_date for ODBC compatibility.Add more functions to odbc.sql catalog extension, use new CREATE ORREPLACE FUNCTION.Document iODBC/unixODBC build options.
1 parent839b9bc commitec5c628

File tree

5 files changed

+300
-174
lines changed

5 files changed

+300
-174
lines changed

‎doc/src/sgml/installation.sgml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.60 2001/10/0918:46:00 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.61 2001/10/0922:32:32 petere Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -696,7 +696,25 @@ su - postgres
696696
<term><option>--enable-odbc</option></term>
697697
<listitem>
698698
<para>
699-
Build the ODBC driver package.
699+
Build the ODBC driver.
700+
</para>
701+
</listitem>
702+
</varlistentry>
703+
704+
<varlistentry>
705+
<term><option>--with-iodbc</option></term>
706+
<listitem>
707+
<para>
708+
Build the ODBC driver for use with <productname>iODBC</>.
709+
</para>
710+
</listitem>
711+
</varlistentry>
712+
713+
<varlistentry>
714+
<term><option>--with-unixodbc</option></term>
715+
<listitem>
716+
<para>
717+
Build the ODBC driver for use with <productname>unixODBC</>.
700718
</para>
701719
</listitem>
702720
</varlistentry>
@@ -708,10 +726,16 @@ su - postgres
708726
Specifies the directory where the ODBC driver will expect its
709727
<filename>odbcinst.ini</> configuration file. The default is
710728
<filename>/usr/local/pgsql/etc</filename> or whatever you
711-
specified as <option>--sysconfdir</option>. A default file
712-
will be installed there. If you intend to share the
713-
<filename>odbcinst.ini</> file between several ODBC drivers
714-
then you may want to use this option.
729+
specified as <option>--sysconfdir</option>. It should be
730+
arranged that the driver reads the same file as the driver
731+
manager.
732+
</para>
733+
734+
<para>
735+
If either the option <option>--with-iodbc</option> or the
736+
option <option>--with-unixodbc</option> is used, this option
737+
will be ignored because in that case the driver manager
738+
handles the location of the configuration file.
715739
</para>
716740
</listitem>
717741
</varlistentry>

‎doc/src/sgml/odbc.sgml

Lines changed: 63 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.24 2001/09/13 15:55:23 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.25 2001/10/09 22:32:32 petere Exp $
33
-->
44

55
<chapter id="odbc">
@@ -80,39 +80,69 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.24 2001/09/13 15:55:23
8080
<title>Installation</title>
8181

8282
<para>
83-
The first thing to note about the <productname>psqlODBC</> driver
84-
(or any <acronym>ODBC</> driver) is that there must exist a
85-
<firstterm>driver manager</> on the system where the
86-
<acronym>ODBC</> driver is to be used. There exists a free
87-
<acronym>ODBC</> driver for Unix called
88-
<indexterm><primary>iODBC</primary></indexterm>
89-
<productname>iODBC</> which can be obtained via <ulink
90-
url="http://www.iodbc.org">http://www.iodbc.org</ulink>.
91-
Instructions for installing <productname>iODBC</> are contained in
92-
the <productname>iODBC</> distribution. Having said that, any
93-
driver manager that you can find for your platform should support
94-
the <productname>psqlODBC</> driver, or any other <acronym>ODBC</>
95-
driver for that matter.
83+
In order to make use of an <acronym>ODBC</> driver there must
84+
exist a <firstterm>driver manager</> on the system where the
85+
<acronym>ODBC</> driver is to be used. There are two free
86+
<acronym>ODBC</> driver managers for Unix-like operating systems
87+
known to us: <indexterm><primary>iODBC</primary></indexterm>
88+
<ulink url="http://www.iodbc.org"><productname>iODBC</></ulink>
89+
and <indexterm><primary>unixODBC</primary></indexterm> <ulink
90+
url="http://www.unixodbc.org"><productname>unixODBC</></ulink>.
91+
Instructions for installing these driver managers are to be found
92+
in the respective distribution. Software that provides database
93+
access through <acronym>ODBC</acronym> should provide its own
94+
driver manager (which may well be one of these two). Having said
95+
that, any driver manager that you can find for your platform
96+
should support the <productname>PostgreSQL</> <acronym>ODBC</>
97+
driver, or any other <acronym>ODBC</> driver for that matter.
98+
</para>
99+
100+
<note>
101+
<para>
102+
The <productname>unixODBC</> distribution ships with a
103+
<productname>PostgreSQL</> <acronym>ODBC</> driver of its own,
104+
which is similar to the one contained in the
105+
<productname>PostgreSQL</> distribution. It is up to you which
106+
one you want to use. We plan to coordinate the development of
107+
both drivers better in the future.
108+
</para>
109+
</note>
110+
111+
<para>
112+
To install the <acronym>ODBC</> you simply need to supply the
113+
<option>--enable-odbc</> option to the <filename>configure</>
114+
script when you are building the entire <productname>PostgreSQL</>
115+
distribution. The library will then automatically be built and
116+
installed with the rest of the programs. If you forget that option
117+
or want to build the ODBC driver later you can change into the
118+
directory <filename>src/interfaces/odbc</> and do <literal>make</>
119+
and <literal>make install</> there.
96120
</para>
97121

98122
<para>
99-
To install <productname>psqlODBC</> you simply need to supply the
100-
<option>--enable-odbc</> option to the <filename>configure</> script when you are
101-
building the entire <productname>PostgreSQL</> distribution. The library
102-
and header files will then automatically be built and installed with the
103-
rest of the programs. If you forget that option or want to build the ODBC
104-
driver later you can change into the directory <filename>src/interfaces/odbc</>
105-
and do <literal>make</> and <literal>make install</> there.
123+
It is also possible to build the driver to be specifically tuned
124+
for use with <productname>iODBC</> or <productname>unixODBC</>.
125+
This means in particular that the driver will use the driver
126+
manager's routines to process the configuration files, which is
127+
probably desirable since it creates a more consistent
128+
<acronym>ODBC</> environment on your system. If you want to do
129+
that, then supply the <filename>configure</> options
130+
<option>--with-iodbc</> or <option>--with-unixodbc</> (but not
131+
both).
106132
</para>
107133

108134
<para>
109-
The installation-wide configuration file <filename>odbcinst.ini</> will be
110-
installed into the directory <filename>/usr/local/pgsql/etc/</>, or equivalent,
111-
depending on what <option>--prefix</> and/or <option>--sysconfdir</> options
112-
you supplied to <filename>configure</>. Since this file can also be shared
113-
between different <acronym>ODBC</> drivers you can also install it in a shared
114-
location. To do that, override the location of this file with the
115-
<option>--with-odbcinst</> option.
135+
If you build a <quote>stand-alone</quote> driver (not tied to
136+
<productname>iODBC</> or <productname>unixODBC</>), then you can
137+
specify where the driver should look for the configuration file
138+
<filename>odbcinst.ini</>. By default it will be the directory
139+
<filename>/usr/local/pgsql/etc/</>, or equivalent, depending on
140+
what <option>--prefix</> and/or <option>--sysconfdir</> options
141+
you supplied to <filename>configure</>. To select a specific
142+
location outside the <productname>PostgreSQL</> installation
143+
layout, use the <option>--with-odbcinst</> option. To be most
144+
useful, it should be arranged that the driver and the driver
145+
manager read the same configuration file.
116146
</para>
117147

118148
<para>
@@ -125,20 +155,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.24 2001/09/13 15:55:23
125155
psql -d template1 -f <replaceable>LOCATION</>/odbc.sql
126156
</programlisting>
127157
where specifying <literal>template1</literal> as the target
128-
database will ensure that all subsequent new databases will
129-
have these same definitions.
158+
database will ensure that all subsequent new databases will have
159+
these same definitions. If for any reason you want to remove
160+
these functions again, run the file
161+
<filename>odbc-drop.sql</filename> through
162+
<command>psql</command>.
130163
</para>
131-
132-
<sect2>
133-
<title>Supported Platforms</title>
134-
<para>
135-
<productname>psqlODBC</productname> has been built and tested
136-
on <systemitem class="osname">Linux</>. There have been reports of success
137-
with <systemitem class="osname">FreeBSD</> and with <systemitem class="osname">Solaris</>. There are no known restrictions
138-
on the basic code for other platforms which already support
139-
<productname>Postgres</productname>.
140-
</para>
141-
</sect2>
142164
</sect1>
143165

144166
<sect1 id="odbc-config">

‎src/backend/parser/gram.y

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.260 2001/10/08 18:16:59 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.261 2001/10/09 22:32:32 petere Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -237,6 +237,7 @@ static void doNegateFloat(Value *v);
237237
%type<list>row_descriptor,row_list,in_expr_nodes
238238
%type<node>row_expr
239239
%type<node>case_expr,case_arg,when_clause,case_default
240+
%type<boolean>opt_empty_parentheses
240241
%type<list>when_clause_list
241242
%type<ival>sub_type
242243
%type<list>OptCreateAs,CreateAsList
@@ -4894,7 +4895,7 @@ c_expr: attr
48944895
n->agg_distinct =FALSE;
48954896
$$ = (Node *)n;
48964897
}
4897-
|CURRENT_DATE
4898+
|CURRENT_DATEopt_empty_parentheses
48984899
{
48994900
/*
49004901
* Translate as "date('now'::text)".
@@ -4927,7 +4928,7 @@ c_expr: attr
49274928

49284929
$$ = (Node *)makeTypeCast((Node *)s, d);
49294930
}
4930-
|CURRENT_TIME
4931+
|CURRENT_TIMEopt_empty_parentheses
49314932
{
49324933
/*
49334934
* Translate as "timetz('now'::text)".
@@ -4978,7 +4979,7 @@ c_expr: attr
49784979

49794980
$$ = (Node *)makeTypeCast((Node *)s, d);
49804981
}
4981-
|CURRENT_TIMESTAMP
4982+
|CURRENT_TIMESTAMPopt_empty_parentheses
49824983
{
49834984
/*
49844985
* Translate as "timestamptz('now'::text)".
@@ -5032,7 +5033,7 @@ c_expr: attr
50325033

50335034
$$ = (Node *)makeTypeCast((Node *)s, d);
50345035
}
5035-
|CURRENT_USER
5036+
|CURRENT_USERopt_empty_parentheses
50365037
{
50375038
FuncCall *n = makeNode(FuncCall);
50385039
n->funcname ="current_user";
@@ -5041,7 +5042,7 @@ c_expr: attr
50415042
n->agg_distinct =FALSE;
50425043
$$ = (Node *)n;
50435044
}
5044-
|SESSION_USER
5045+
|SESSION_USERopt_empty_parentheses
50455046
{
50465047
FuncCall *n = makeNode(FuncCall);
50475048
n->funcname ="session_user";
@@ -5050,7 +5051,7 @@ c_expr: attr
50505051
n->agg_distinct =FALSE;
50515052
$$ = (Node *)n;
50525053
}
5053-
|USER
5054+
|USERopt_empty_parentheses
50545055
{
50555056
FuncCall *n = makeNode(FuncCall);
50565057
n->funcname ="current_user";
@@ -5386,6 +5387,8 @@ attrs: attr_name
53865387
{$$ = lappend($1, makeString("*")); }
53875388
;
53885389

5390+
opt_empty_parentheses:'('')' {$$ =TRUE; }
5391+
|/*EMPTY*/ {$$ =TRUE; }
53895392

53905393
/*****************************************************************************
53915394
*

‎src/interfaces/odbc/GNUmakefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# GNUMakefile for psqlodbc (Postgres ODBC driver)
44
#
5-
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.21 2001/09/23 13:32:24 petere Exp $
5+
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.22 2001/10/09 22:32:33 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -43,7 +43,7 @@ OBJS += gpps.o
4343
overrideCPPFLAGS += -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
4444
endif
4545

46-
all: all-lib
46+
all: all-lib odbc-drop.sql
4747

4848
# Shared library stuff
4949
include$(top_srcdir)/src/Makefile.shlib
@@ -53,16 +53,20 @@ include $(top_srcdir)/src/Makefile.shlib
5353
# names and we don't want those. (This issue is probably ELF specific.)
5454
LINK.shared +=$(shlib_symbolic)
5555

56+
odbc-drop.sql: odbc.sql
57+
sed -n'/^CREATE OR REPLACE FUNCTION/s/CREATE OR REPLACE FUNCTION \([^ (][^ (]*([^)]*)\).*/DROP FUNCTION \1;/p'$<>$@
5658

5759
install: all installdirs
5860
$(INSTALL_DATA)$(srcdir)/odbc.sql$(DESTDIR)$(datadir)/odbc.sql
61+
$(INSTALL_DATA) odbc-drop.sql$(DESTDIR)$(datadir)/odbc-drop.sql
5962
$(MAKE) install-lib
6063

6164
installdirs:
6265
$(mkinstalldirs)$(DESTDIR)$(libdir)$(DESTDIR)$(datadir)
6366

6467
uninstall: uninstall-lib
65-
rm -f$(DESTDIR)$(datadir)/odbc.sql
68+
rm -f$(DESTDIR)$(datadir)/odbc.sql$(DESTDIR)$(datadir)/odbc-drop.sql
6669

6770
cleandistcleanmaintainer-clean: clean-lib
6871
rm -f$(OBJS)
72+
rm -f odbc-drop.sql

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp