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

Commitabbd64c

Browse files
author
Thomas G. Lockhart
committed
Support ODBC-style CURRENT_TIME, CURRENT_USER, etc with trailing empty
parens. This is not SQL spec syntax, so later we will remove this extension from gram.y.
1 parenta4420c4 commitabbd64c

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

‎src/interfaces/odbc/convert.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ char *mapFuncs[][2] = {
9494
/*{ "TAN", "tan" }, */
9595
{"TRUNCATE","trunc"},
9696

97+
{"CURRENT_DATE","curdate"},
98+
{"CURRENT_TIME","curtime"},
99+
{"CURRENT_TIMESTAMP","odbc_timestamp"},
100+
{"CURRENT_USER","odbc_current_user"},
101+
{"SESSION_USER","odbc_session_user"},
102+
{"CURRENT_DATE","curdate"},
103+
{"CURRENT_TIME","curtime"},
104+
{"CURRENT_TIMESTAMP","odbc_timestamp"},
105+
{"CURRENT_USER","odbc_current_user"},
106+
{"SESSION_USER","odbc_session_user"},
97107
/*{ "CURDATE", "curdate" }, */
98108
/*{ "CURTIME", "curtime" }, */
99109
/*{ "DAYNAME", "dayname" }, */

‎src/interfaces/odbc/odbc.sql

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- PostgreSQL catalog extensions for ODBC compatibility
2-
-- $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/odbc.sql,v 1.4 2001/12/02 11:36:04 petere Exp $
2+
-- $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/odbc.sql,v 1.5 2001/12/10 00:01:14 thomas Exp $
33

44
-- ODBC functions are described here:
55
-- <http://msdn.microsoft.com/library/en-us/odbc/htm/odbcscalar_functions.asp>
@@ -141,6 +141,14 @@ CREATE OR REPLACE FUNCTION curtime() RETURNS time with time zone AS '
141141
SELECT current_time;
142142
' LANGUAGE SQL;
143143

144+
CREATE OR REPLACEFUNCTIONodbc_timestamp() RETURNStimestamp with time zoneAS'
145+
SELECT current_timestamp;
146+
' LANGUAGE SQL;
147+
148+
CREATE OR REPLACEFUNCTIONodbc_timestamp() RETURNStimestamp with time zoneAS'
149+
SELECT current_timestamp;
150+
' LANGUAGE SQL;
151+
144152
CREATE OR REPLACEFUNCTIONdayname(timestamp) RETURNStextAS'
145153
SELECT to_char($1,''Day'');
146154
' LANGUAGE SQL;
@@ -206,7 +214,31 @@ CREATE OR REPLACE FUNCTION year(timestamp) RETURNS integer AS '
206214

207215

208216
-- System Functions
217+
218+
CREATE OR REPLACEFUNCTIONodbc_user() RETURNStextAS'
219+
SELECT CAST(current_user AS TEXT);
220+
' LANGUAGE SQL;
221+
222+
CREATE OR REPLACEFUNCTIONodbc_current_user() RETURNStextAS'
223+
SELECT CAST(current_user AS TEXT);
224+
' LANGUAGE SQL;
225+
226+
CREATE OR REPLACEFUNCTIONodbc_session_user() RETURNStextAS'
227+
SELECT CAST(session_user AS TEXT);
228+
' LANGUAGE SQL;
209229
-- ++++++++++++++++
210230
--
211231
-- Built-in: USER
212232
-- Missing: DATABASE, IFNULL
233+
234+
CREATE OR REPLACEFUNCTIONodbc_user() RETURNStextAS'
235+
SELECT CAST(current_user AS TEXT);
236+
' LANGUAGE SQL;
237+
238+
CREATE OR REPLACEFUNCTIONodbc_current_user() RETURNStextAS'
239+
SELECT CAST(current_user AS TEXT);
240+
' LANGUAGE SQL;
241+
242+
CREATE OR REPLACEFUNCTIONodbc_session_user() RETURNStextAS'
243+
SELECT CAST(session_user AS TEXT);
244+
' LANGUAGE SQL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp