Remove support for protocol versions older than 3.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 29 Oct 2014 14:35:05 +0000 (16:35 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 29 Oct 2014 16:19:27 +0000 (18:19 +0200)
PostgreSQL added support for protocol version 3 in server version 7.4.
There's no need to support servers older than that. This simplifies the
code a lot, removing a lot of corner cases that haven't been properly
regression tested for a long time anyway.

Original patch by me, with some tweaks by Michael Paquier.

29 files changed:
columninfo.c
columninfo.h
connection.c
connection.h
convert.c
descriptor.c
dlg_specific.c
dlg_specific.h
dlg_wingui.c
execute.c
info.c
info30.c
misc.c
multibyte.c
odbcapi.c
odbcapiw.c
options.c
parse.c
pgtypes.c
psqlodbc.c
psqlodbc.h
psqlodbc.rc
qresult.c
resource.h
results.c
socket.c
socket.h
statement.c
statement.h

index 7089feeeaf23e530e642e365b7edcf785da40384..ae275a22fd45fb6350bccb7233ff92e667fc9473 100644 (file)
@@ -66,10 +66,8 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
    /* COLUMN_NAME_STORAGE_LEN may be sufficient but for safety */
    char        new_field_name[2 * COLUMN_NAME_STORAGE_LEN + 1];
    SocketClass *sock;
-   ConnInfo   *ci;
 
    sock = CC_get_socket(conn);
-   ci = &conn->connInfo;
 
    /* at first read in the number of fields that are in the query */
    new_num_fields = (Int2) SOCK_get_int(sock, sizeof(Int2));
@@ -79,7 +77,7 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
    if (self)
    {
        /* according to that allocate memory */
-       CI_set_num_fields(self, new_num_fields, PROTOCOL_74(ci));
+       CI_set_num_fields(self, new_num_fields);
        if (NULL == self->coli_array)
            return FALSE;
    }
@@ -88,37 +86,29 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
    for (lf = 0; lf < new_num_fields; lf++)
    {
        SOCK_get_string(sock, new_field_name, 2 * COLUMN_NAME_STORAGE_LEN);
-       if (PROTOCOL_74(ci))    /* tableid & columnid */
-       {
-           new_relid = SOCK_get_int(sock, sizeof(Int4));
-           new_attid = SOCK_get_int(sock, sizeof(Int2));
-       }
+       new_relid = SOCK_get_int(sock, sizeof(Int4));
+       new_attid = SOCK_get_int(sock, sizeof(Int2));
        new_adtid = (OID) SOCK_get_int(sock, 4);
        new_adtsize = (Int2) SOCK_get_int(sock, 2);
 
-       /* If 6.4 protocol, then read the atttypmod field */
-       if (PG_VERSION_GE(conn, 6.4))
-       {
-           mylog("READING ATTTYPMOD\n");
-           new_atttypmod = (Int4) SOCK_get_int(sock, 4);
-
-           /* Subtract the header length */
-           switch (new_adtid)
-           {
-               case PG_TYPE_DATETIME:
-               case PG_TYPE_TIMESTAMP_NO_TMZONE:
-               case PG_TYPE_TIME:
-               case PG_TYPE_TIME_WITH_TMZONE:
-                   break;
-               default:
-                   new_atttypmod -= 4;
-           }
-           if (new_atttypmod < 0)
-               new_atttypmod = -1;
-           if (PROTOCOL_74(ci))    /* format */
-               SOCK_get_int(sock, sizeof(Int2));
+       mylog("READING ATTTYPMOD\n");
+       new_atttypmod = (Int4) SOCK_get_int(sock, 4);
 
+       /* Subtract the header length */
+       switch (new_adtid)
+       {
+           case PG_TYPE_DATETIME:
+           case PG_TYPE_TIMESTAMP_NO_TMZONE:
+           case PG_TYPE_TIME:
+           case PG_TYPE_TIME_WITH_TMZONE:
+               break;
+           default:
+               new_atttypmod -= 4;
        }
+       if (new_atttypmod < 0)
+           new_atttypmod = -1;
+       /* format */
+       SOCK_get_int(sock, sizeof(Int2));
 
        mylog("%s: fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d (rel,att)=(%d,%d)\n", func, new_field_name, new_adtid, new_adtsize, new_atttypmod, new_relid, new_attid);
 
@@ -155,7 +145,7 @@ CI_free_memory(ColumnInfoClass *self)
 
 
 void
-CI_set_num_fields(ColumnInfoClass *self, int new_num_fields, BOOL allocrelatt)
+CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
 {
    CI_free_memory(self);       /* always safe to call */
 
index 72c6e132a05f9b0b7fbed9f523b454d3885b21f4..7901167b8652d9eb1dc3cabc378db36c05f0ee87 100644 (file)
@@ -44,7 +44,7 @@ char      CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn);
 
 /* functions for setting up the fields from within the program, */
 /* without reading from a socket */
-void       CI_set_num_fields(ColumnInfoClass *self, int new_num_fields, BOOL);
+void       CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
 void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
        OID new_adtid, Int2 new_adtsize, Int4 atttypmod,
        OID new_relid, OID new_attid);
index af985f2d10f7f75f869b3f0359859ee2eed5a370..00e1f985dc65ffcbcbb1c897c44dc3b154d2d50e 100644 (file)
@@ -60,7 +60,6 @@
 
 #define PRN_NULLCHECK
 
-static void CC_lookup_pg_version(ConnectionClass *self);
 static void CC_lookup_lo(ConnectionClass *self);
 static char *CC_create_errormsg(ConnectionClass *self);
 static int  CC_close_eof_cursors(ConnectionClass *self);
@@ -325,7 +324,6 @@ CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci)
    CORR_STRCPY(database);
    CORR_STRCPY(username);
    NAME_TO_NAME(ci->password, sci->password);
-   CORR_STRCPY(protocol);
    CORR_STRCPY(port);
    CORR_STRCPY(sslmode);
    CORR_STRCPY(onlyread);
@@ -894,11 +892,9 @@ inolog("md5 pwd=%s user=%s salt=%02x%02x%02x%02x%02x\n", PRINT_NAME(ci->password
        return 1;
    }
    free(pwd1);
-   if (PROTOCOL_74(&(self->connInfo)))
-   {
-inolog("putting p and %s\n", pwd2);
-       SOCK_put_char(sock, 'p');
-   }
+   inolog("putting p and %s\n", pwd2);
+   SOCK_put_char(sock, 'p');
+
    md5len = strlen(pwd2);
    SOCK_put_int(sock, (Int4) (4 + md5len + 1), 4);
    SOCK_put_n_char(sock, pwd2, (md5len + 1));
@@ -912,110 +908,82 @@ int
 EatReadyForQuery(ConnectionClass *conn)
 {
    int id = 0;
+   BOOL    is_in_error_trans = CC_is_in_error_trans(conn);
 
-   if (PROTOCOL_74(&(conn->connInfo)))
+   switch (id = SOCK_get_char(conn->sock))
    {
-       BOOL    is_in_error_trans = CC_is_in_error_trans(conn);
-       switch (id = SOCK_get_char(conn->sock))
-       {
-           case 'I':
-               if (CC_is_in_trans(conn))
-               {
-                   if (is_in_error_trans)
-                       CC_on_abort(conn, NO_TRANS);
-                   else
-                       CC_on_commit(conn);
-               }
-               break;
-           case 'T':
-               CC_set_in_trans(conn);
-               CC_set_no_error_trans(conn);
+       case 'I':
+           if (CC_is_in_trans(conn))
+           {
                if (is_in_error_trans)
-                   CC_on_abort_partial(conn);
-               break;
-           case 'E':
-               CC_set_in_error_trans(conn);
-               break;
-       }
-       conn->stmt_in_extquery = NULL;
+                   CC_on_abort(conn, NO_TRANS);
+               else
+                   CC_on_commit(conn);
+           }
+           break;
+       case 'T':
+           CC_set_in_trans(conn);
+           CC_set_no_error_trans(conn);
+           if (is_in_error_trans)
+               CC_on_abort_partial(conn);
+           break;
+       case 'E':
+           CC_set_in_error_trans(conn);
+           break;
    }
+   conn->stmt_in_extquery = NULL;
+
    return id;
 }
 
 int
-handle_error_message(ConnectionClass *self, char *msgbuf, size_t buflen, char *sqlstate, const char *comment, QResultClass *res)
+handle_error_message(ConnectionClass *self,
+                    char *msgbuf,
+                    size_t buflen,
+                    char *sqlstate,
+                    const char *comment,
+                    QResultClass *res)
 {
-   BOOL    new_format = FALSE, msg_truncated = FALSE, truncated, hasmsg = FALSE;
+   BOOL    msg_truncated = FALSE;
+   BOOL    hasmsg = FALSE;
+   BOOL    truncated;
    SocketClass *sock = self->sock;
-   ConnInfo    *ci = &(self->connInfo);
    char    msgbuffer[ERROR_MSG_LENGTH];
    UDWORD  abort_opt;
 
-   inolog("handle_error_message protocol=%s\n", ci->protocol);
-   if (PROTOCOL_74(ci))
-       new_format = TRUE;
-   else if (PROTOCOL_74REJECTED(ci))
-   {
-       if (!SOCK_get_next_byte(sock, TRUE)) /* peek the next byte */
-       {
-           uint32  leng;
+   inolog("handle_error_message");
+   truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
 
-           mylog("peek the next byte = \\0\n");
-           new_format = TRUE;
-           strncpy_null(ci->protocol, PG74, sizeof(ci->protocol));
-           leng = SOCK_get_response_length(sock);
-           inolog("get the response length=%d\n", leng);
-       }
-   }
-
-inolog("new_format=%d\n", new_format);
-   truncated = SOCK_get_string(sock,
-                               new_format ? msgbuffer : msgbuf,
-                               new_format ? sizeof(msgbuffer) : (Int4) buflen);
-   if (new_format)
+   msgbuf[0] = '\0';
+   for (;msgbuffer[0];)
    {
-       msgbuf[0] = '\0';
-       for (;msgbuffer[0];)
+       mylog("%s: 'E' - %s\n", comment, msgbuffer);
+       qlog("ERROR from backend during %s: '%s'\n", comment, msgbuffer);
+       switch (msgbuffer[0])
        {
-           mylog("%s: 'E' - %s\n", comment, msgbuffer);
-           qlog("ERROR from backend during %s: '%s'\n", comment, msgbuffer);
-           switch (msgbuffer[0])
-           {
-               case 'S':
-                   strlcat(msgbuf, msgbuffer + 1, buflen);
-                   strlcat(msgbuf, ": ", buflen);
-                   break;
-               case 'M':
-               case 'D':
-                   if (hasmsg)
-                       strlcat(msgbuf, "\n", buflen);
-                   strlcat(msgbuf, msgbuffer + 1, buflen);
-                   if (truncated)
-                       msg_truncated = truncated;
-                   hasmsg = TRUE;
-                   break;
-               case 'C':
-                   if (sqlstate)
-                       strncpy_null(sqlstate, msgbuffer + 1, 8);
-                   break;
+           case 'S':
+               strlcat(msgbuf, msgbuffer + 1, buflen);
+               strlcat(msgbuf, ": ", buflen);
+               break;
+           case 'M':
+           case 'D':
+               if (hasmsg)
+                   strlcat(msgbuf, "\n", buflen);
+               strlcat(msgbuf, msgbuffer + 1, buflen);
+               if (truncated)
+                   msg_truncated = truncated;
+               hasmsg = TRUE;
+               break;
+           case 'C':
+               if (sqlstate)
+                   strncpy_null(sqlstate, msgbuffer + 1, 8);
+               break;
            }
-           while (truncated)
-               truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
-           truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
-       }
-   }
-   else
-   {
-       msg_truncated = truncated;
-       /* Remove a newline */
-       if (msgbuf[0] != '\0' && msgbuf[(int)strlen(msgbuf) - 1] == '\n')
-           msgbuf[(int)strlen(msgbuf) - 1] = '\0';
-
-       mylog("%s: 'E' - %s\n", comment, msgbuf);
-       qlog("ERROR from backend during %s: '%s'\n", comment, msgbuf);
        while (truncated)
            truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
+       truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
    }
+
    abort_opt = 0;
    if (!strncmp(msgbuf, "FATAL", 5))
    {
@@ -1047,66 +1015,49 @@ inolog("new_format=%d\n", new_format);
 int
 handle_notice_message(ConnectionClass *self, char *msgbuf, size_t buflen, char *sqlstate, const char *comment, QResultClass *res)
 {
-   BOOL    new_format = FALSE, msg_truncated = FALSE, truncated, hasmsg = FALSE;
+   BOOL    msg_truncated = FALSE;
+   BOOL    hasmsg = FALSE;
+   BOOL    truncated;
    SocketClass *sock = self->sock;
    char    msgbuffer[ERROR_MSG_LENGTH];
+   size_t  dstlen = 0;
 
-   if (PROTOCOL_74(&(self->connInfo)))
-       new_format = TRUE;
-
-   if (new_format)
+   msgbuf[0] = '\0';
+   for (;;)
    {
-       size_t  dstlen = 0;
+       truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
+       if (!msgbuffer[0])
+           break;
 
-       msgbuf[0] = '\0';
-       for (;;)
+       mylog("%s: 'N' - %s\n", comment, msgbuffer);
+       qlog("NOTICE from backend during %s: '%s'\n", comment, msgbuffer);
+       switch (msgbuffer[0])
        {
-           truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
-           if (!msgbuffer[0])
+           case 'S':
+               strlcat(msgbuf, msgbuffer + 1, buflen);
+               dstlen = strlcat(msgbuf, ": ", buflen);
+               break;
+           case 'M':
+           case 'D':
+               if (hasmsg)
+                   strlcat(msgbuf, "\n", buflen);
+               dstlen = strlcat(msgbuf, msgbuffer + 1, buflen);
+               if (truncated)
+                   msg_truncated = truncated;
+               hasmsg = TRUE;
+               break;
+           case 'C':
+               if (sqlstate && !sqlstate[0] && strcmp(msgbuffer + 1, "00000"))
+                   strncpy_null(sqlstate, msgbuffer + 1, 8);
                break;
-
-           mylog("%s: 'N' - %s\n", comment, msgbuffer);
-           qlog("NOTICE from backend during %s: '%s'\n", comment, msgbuffer);
-           switch (msgbuffer[0])
-           {
-               case 'S':
-                   strlcat(msgbuf, msgbuffer + 1, buflen);
-                   dstlen = strlcat(msgbuf, ": ", buflen);
-                   break;
-               case 'M':
-               case 'D':
-                   if (hasmsg)
-                       strlcat(msgbuf, "\n", buflen);
-                   dstlen = strlcat(msgbuf, msgbuffer + 1, buflen);
-                   if (truncated)
-                       msg_truncated = truncated;
-                   hasmsg = TRUE;
-                   break;
-               case 'C':
-                   if (sqlstate && !sqlstate[0] && strcmp(msgbuffer + 1, "00000"))
-                       strncpy_null(sqlstate, msgbuffer + 1, 8);
-                   break;
-           }
-           if (dstlen >= buflen)
-               msg_truncated = TRUE;
-           while (truncated)
-               truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
        }
-mylog("notice message len=%d\n", strlen(msgbuf));
-   }
-   else
-   {
-       msg_truncated = SOCK_get_string(sock, msgbuf, (Int4) buflen);
-
-       /* Remove a newline */
-       if (msgbuf[0] != '\0' && msgbuf[strlen(msgbuf) - 1] == '\n')
-           msgbuf[strlen(msgbuf) - 1] = '\0';
-
-       mylog("%s: 'N' - %s\n", comment, msgbuf);
-       qlog("NOTICE from backend during %s: '%s'\n", comment, msgbuf);
-       for (truncated = msg_truncated; truncated;)
+       if (dstlen >= buflen)
+           msg_truncated = TRUE;
+       while (truncated)
            truncated = SOCK_get_string(sock, msgbuffer, sizeof(msgbuffer));
    }
+   mylog("notice message len=%d\n", strlen(msgbuf));
+
    if (res)
    {
        if (QR_command_successful(res))
@@ -1169,8 +1120,6 @@ inolog("parameter name=%s\n", msgbuffer);
            conn->pg_version_minor = minor;
        }
        conn->pg_version_number = (float) atof(szVersion);
-       if (PG_VERSION_GE(conn, 7.3))
-           conn->schema_support = 1;
 
        mylog("Got the PostgreSQL version string: '%s'\n", conn->pg_version);
        mylog("Extracted PostgreSQL version number: '%1.1f'\n", conn->pg_version_number);
@@ -1486,9 +1435,8 @@ static char CC_initial_log(ConnectionClass *self, const char *func)
         ci->drivers.unknown_sizes,
         ci->drivers.max_varchar_size,
         ci->drivers.max_longvarchar_size);
-   qlog("                disable_optimizer=%d, ksqo=%d, unique_index=%d, use_declarefetch=%d\n",
+   qlog("                disable_optimizer=%d, unique_index=%d, use_declarefetch=%d\n",
         ci->drivers.disable_optimizer,
-        ci->drivers.ksqo,
         ci->drivers.unique_index,
         ci->drivers.use_declarefetch);
    qlog("                text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d NAMEDATALEN=%d\n",
@@ -1609,9 +1557,6 @@ mylog("!!! %s settings=%s svcname=%p\n", __FUNCTION__, ci->conn_settings, svcnam
 static char
 original_CC_connect(ConnectionClass *self, char password_req, char *salt_para)
 {
-   StartupPacket sp;
-   StartupPacket6_2 sp62;
-   QResultClass *res;
    SocketClass *sock = NULL;
    ConnInfo   *ci = &(self->connInfo);
    int     areq = -1;
@@ -1671,28 +1616,14 @@ another_version_retry:
        if (anotherVersionRetry)
        {
 #ifdef USE_SSPI
-           if (PROTOCOL_74(ci) || PROTOCOL_64(ci))
-           {
-               if (ssl_try_no < ssl_try_count)
-                   ssl_try_no++;
-           }
-           else
-               ssl_try_no = ssl_try_count;
+           if (ssl_try_no < ssl_try_count)
+               ssl_try_no++;
+
            if (ssl_try_no >= ssl_try_count)
            {
 #endif /* USE_SSPI */
-               /* retry older version */
-               if (PROTOCOL_62(ci))
-               {
-                   CC_set_error(self, CONNECTION_SERVER_NOT_REACHED, "Could not construct a socket to the server", func);
-                   goto error_proc;
-               }
-               if (PROTOCOL_63(ci))
-                   strncpy_null(ci->protocol, PG62, sizeof(ci->protocol));
-               else if (PROTOCOL_64(ci))
-                   strncpy_null(ci->protocol, PG63, sizeof(ci->protocol));
-               else
-                   strncpy_null(ci->protocol, PG64, sizeof(ci->protocol));
+               CC_set_error(self, CONNECTION_SERVER_NOT_REACHED, "Could not construct a socket to the server", func);
+               goto error_proc;
 #ifdef USE_SSPI
                ssl_try_no = 0;
            }
@@ -1732,7 +1663,7 @@ another_version_retry:
        }
        mylog("connection to the server socket succeeded.\n");
 
-inolog("protocol=%s version=%d,%d\n", ci->protocol, self->pg_version_major, self->pg_version_minor);
+       inolog("version=%d,%d\n", self->pg_version_major, self->pg_version_minor);
 #ifdef USE_SSPI
        if ('y' == ssl_call[ssl_try_no])
        {
@@ -1785,46 +1716,8 @@ inolog("protocol=%s version=%d,%d\n", ci->protocol, self->pg_version_major, self
            }
        }
 #endif /* USE_SSPI */
-       if (PROTOCOL_62(ci))
-       {
-           sock->reverse = TRUE;       /* make put_int and get_int work
-                                        * for 6.2 */
-
-           memset(&sp62, 0, sizeof(StartupPacket6_2));
-           sock->pversion = PG_PROTOCOL_62;
-           SOCK_put_int(sock, htonl(4 + sizeof(StartupPacket6_2)), 4);
-           sp62.authtype = htonl(NO_AUTHENTICATION);
-           strncpy_null(sp62.database, ci->database, PATH_SIZE);
-           strncpy_null(sp62.user, ci->username, USRNAMEDATALEN);
-           SOCK_put_n_char(sock, (char *) &sp62, sizeof(StartupPacket6_2));
-           SOCK_flush_output(sock);
-       }
-       else if (PROTOCOL_74(ci))
-       {
-           if (!protocol3_packet_build(self))
-               goto error_proc;
-       }
-       else
-       {
-           memset(&sp, 0, sizeof(StartupPacket));
-
-           mylog("sizeof startup packet = %d\n", sizeof(StartupPacket));
-
-           if (PROTOCOL_63(ci))
-               sock->pversion = PG_PROTOCOL_63;
-           else
-               sock->pversion = PG_PROTOCOL_64;
-           /* Send length of Authentication Block */
-           SOCK_put_int(sock, 4 + sizeof(StartupPacket), 4);
-
-           sp.protoVersion = (ProtocolVersion) htonl(sock->pversion);
-
-           strncpy_null(sp.database, ci->database, SM_DATABASE);
-           strncpy_null(sp.user, ci->username, SM_USER);
-
-           SOCK_put_n_char(sock, (char *) &sp, sizeof(StartupPacket));
-           SOCK_flush_output(sock);
-       }
+       if (!protocol3_packet_build(self))
+           goto error_proc;
 
        if (SOCK_get_errcode(sock) != 0)
        {
@@ -1841,11 +1734,8 @@ inolog("protocol=%s version=%d,%d\n", ci->protocol, self->pg_version_major, self
    /*
     * Now get the authentication request from backend
     */
-
-   if (!PROTOCOL_62(ci))
    {
-       BOOL        beforeV2 = !(PROTOCOL_64(&self->connInfo) || PROTOCOL_74(&self->connInfo)),
-                   ReadyForQuery = FALSE, retry = FALSE;
+       BOOL    ReadyForQuery = FALSE, retry = FALSE;
        uint32  leng = 0;
 #if defined(USE_GSS) || defined(USE_SSPI) || defined(USE_KRB5)
        int authRet;
@@ -1864,17 +1754,12 @@ inolog("protocol=%s version=%d,%d\n", ci->protocol, self->pg_version_major, self
                mylog("auth got '%c'\n", beresp);
                if (0 != SOCK_get_errcode(sock))
                    goto sockerr_proc;
-               if (PROTOCOL_74(ci))
+               if (beresp != 'E' || startPacketReceived)
                {
-                   if (beresp != 'E' || startPacketReceived)
-                   {
-                       leng = SOCK_get_response_length(sock);
-                       inolog("leng=%d\n", leng);
-                       if (0 != SOCK_get_errcode(sock))
-                           goto sockerr_proc;
-                   }
-                   else
-                       strncpy_null(ci->protocol, PG74REJECTED, sizeof(ci->protocol));
+                   leng = SOCK_get_response_length(sock);
+                   inolog("leng=%d\n", leng);
+                   if (0 != SOCK_get_errcode(sock))
+                       goto sockerr_proc;
                }
                startPacketReceived = TRUE;
            }
@@ -1886,9 +1771,7 @@ inolog("Ekita retry=%d\n", retry);
                    handle_error_message(self, msgbuffer, sizeof(msgbuffer), self->sqlstate, func, NULL);
                    CC_set_error(self, CONN_INVALID_AUTHENTICATION, msgbuffer, func);
                    qlog("ERROR from backend during authentication: '%s'\n", msgbuffer);
-                   if (PROTOCOL_74REJECTED(ci))
-                       retry = TRUE;
-                   else if (0 == strncmp(msgbuffer, "FATAL:", 6))
+                   if (0 == strncmp(msgbuffer, "FATAL:", 6))
                    {
                        const char *emsg = msgbuffer + 8;
                        if (0 == strnicmp(emsg, "unsupported frontend protocol", 29))
@@ -1964,8 +1847,7 @@ inolog("Ekita retry=%d\n", retry);
 
                            mylog("past need password\n");
 
-                           if (PROTOCOL_74(&(self->connInfo)))
-                               SOCK_put_char(sock, 'p');
+                           SOCK_put_char(sock, 'p');
                            SOCK_put_int(sock, (Int4) (4 + strlen(SAFE_NAME(ci->password)) + 1), 4);
                            SOCK_put_n_char(sock, SAFE_NAME(ci->password), strlen(SAFE_NAME(ci->password)) + 1);
                            sockerr = SOCK_flush_output(sock);
@@ -2105,12 +1987,6 @@ inolog("Ekita retry=%d\n", retry);
                anotherVersionRetry = TRUE;
                goto another_version_retry;
            }
-
-           /*
-            * There were no ReadyForQuery responce before 6.4.
-            */
-           if (beforeV2 && areq == AUTH_REQ_OK)
-               ReadyForQuery = TRUE;
        } while (!ReadyForQuery);
    }
 
@@ -2136,37 +2012,6 @@ error_proc:
 
    CC_clear_error(self);       /* clear any password error */
 
-   /*
-    * send an empty query in order to find out whether the specified
-    * database really exists on the server machine
-    */
-   if (!PROTOCOL_74(ci))
-   {
-       mylog("sending an empty query...\n");
-
-       res = CC_send_query(self, " ", NULL, 0, NULL);
-       if (res == NULL ||
-           (QR_get_rstatus(res) != PORES_EMPTY_QUERY &&
-            QR_command_nonfatal(res)))
-       {
-           CC_set_error(self, CONNECTION_NO_SUCH_DATABASE, "The database does not exist on the server\nor user authentication failed.", func);
-           QR_Destructor(res);
-           return 0;
-       }
-       QR_Destructor(res);
-
-       mylog("empty query seems to be OK.\n");
-
-       /*
-        * Get the version number first so we can check it before
-        * sending options that are now obsolete. DJP 21/06/2002
-        */
-inolog("CC_lookup_pg_version\n");
-       CC_lookup_pg_version(self); /* Get PostgreSQL version for
-                          SQLGetInfo use */
-       CC_setenv(self);
-   }
-
    return 1;
 }
 /*
@@ -2254,65 +2099,43 @@ inolog("CC_send_settings\n");
    CC_lookup_lo(self);         /* a hack to get the oid of
                           our large object oid type */
 
-   /*
-    *  Multibyte handling is available ?
-    */
-   if (PG_VERSION_GE(self, 6.4))
+   /* Multibyte handling */
+   CC_lookup_characterset(self);
+   if (CC_get_errornumber(self) > 0)
    {
-       CC_lookup_characterset(self);
-       if (CC_get_errornumber(self) > 0)
-       {
-           ret = 0;
-           goto cleanup;
-       }
+       ret = 0;
+       goto cleanup;
+   }
 #ifdef UNICODE_SUPPORT
-       if (CC_is_in_unicode_driver(self))
+   if (CC_is_in_unicode_driver(self))
+   {
+       if (!self->original_client_encoding ||
+           UTF8 != self->ccsc)
        {
-           if (!self->original_client_encoding ||
-               UTF8 != self->ccsc)
+           QResultClass    *res;
+           if (self->original_client_encoding)
+               free(self->original_client_encoding);
+           self->original_client_encoding = NULL;
+           if (res = CC_send_query(self, "set client_encoding to 'UTF8'", NULL, 0, NULL), QR_command_maybe_successful(res))
            {
-               QResultClass    *res;
-               if (PG_VERSION_LT(self, 7.1))
-               {
-                   CC_set_error(self, CONN_NOT_IMPLEMENTED_ERROR, "UTF-8 conversion isn't implemented before 7.1", func);
-                   ret = 0;
-                   goto cleanup;
-               }
-               if (self->original_client_encoding)
-                   free(self->original_client_encoding);
-               self->original_client_encoding = NULL;
-               if (res = CC_send_query(self, "set client_encoding to 'UTF8'", NULL, 0, NULL), QR_command_maybe_successful(res))
-               {
-                   self->original_client_encoding = strdup("UNICODE");
-                   self->ccsc = pg_CS_code(self->original_client_encoding);
-               }
-               QR_Destructor(res);
+               self->original_client_encoding = strdup("UNICODE");
+               self->ccsc = pg_CS_code(self->original_client_encoding);
            }
+           QR_Destructor(res);
        }
-#else
-       {
-       }
-#endif /* UNICODE_SUPPORT */
    }
-#ifdef UNICODE_SUPPORT
-   else if (CC_is_in_unicode_driver(self))
+#else
    {
-       CC_set_error(self, CONN_NOT_IMPLEMENTED_ERROR, "Unicode isn't supported before 6.4", func);
-       ret = 0;
-       goto cleanup;
    }
 #endif /* UNICODE_SUPPORT */
+
    ci->updatable_cursors = DISALLOW_UPDATABLE_CURSORS;
-   if (ci->allow_keyset &&
-       PG_VERSION_GE(self, 7.0)) /* Tid scan since 7.0 */
+   if (ci->allow_keyset)
    {
        if (ci->drivers.lie || !ci->drivers.use_declarefetch)
            ci->updatable_cursors |= (ALLOW_STATIC_CURSORS | ALLOW_KEYSET_DRIVEN_CURSORS | ALLOW_BULK_OPERATIONS | SENSE_SELF_OPERATIONS);
        else
-       {
-           if (PG_VERSION_GE(self, 7.4)) /* HOLDABLE CURSORS since 7.4 */
-               ci->updatable_cursors |= (ALLOW_STATIC_CURSORS | SENSE_SELF_OPERATIONS);
-       }
+           ci->updatable_cursors |= (ALLOW_STATIC_CURSORS | SENSE_SELF_OPERATIONS);
    }
 
    if (CC_get_errornumber(self) > 0)
@@ -2805,11 +2628,10 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD
            lenrlscmd = 0, lenperqsvp = 0;
    size_t  qrylen;
    int         id;
-   int         maxlen,
-               empty_reqs;
+   SocketClass *sock = self->sock;
+   int         empty_reqs;
    BOOL        ReadyToReturn = FALSE,
                query_completed = FALSE,
-               beforeV2 = !(PROTOCOL_64(&self->connInfo) || PROTOCOL_74(&self->connInfo)),
                aborted = FALSE,
                used_passed_result_object = FALSE,
            discard_next_begin = FALSE,
@@ -2818,7 +2640,6 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD
            consider_rollback;
    Int4        response_length;
    UInt4       leng;
-   ConnInfo    *ci = &(self->connInfo);
    int     func_cs_count = 0;
 
    /* ERROR_MSG_LENGTH is suffcient */
@@ -2858,14 +2679,7 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD
        }
    }
    /* Indicate that we are sending a query to the backend */
-   maxlen = CC_get_max_query_len(self);
    qrylen = strlen(query);
-   if (maxlen > 0 && maxlen < (int) qrylen + 1)
-   {
-       CC_set_error(self, CONNECTION_MSG_TOO_LONG, "Query string is too long", func);
-       CLEANUP_FUNC_CONN_CS(func_cs_count, self);
-       return NULL;
-   }
 
    if ((NULL == query) || (query[0] == '\0'))
    {
@@ -2944,22 +2758,21 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD
        lenrlscmd = strlen(rlscmd);
        lenperqsvp = strlen(per_query_svp);
    }
-   if (PROTOCOL_74(ci))
+
+   leng = (UInt4) qrylen;
+   if (appendq)
+       leng += (UInt4) (strlen(appendq) + 1);
+   if (issue_begin)
+       leng += (UInt4) (lenbgncmd + 1);
+   if (query_rollback)
    {
-       leng = (UInt4) qrylen;
-       if (appendq)
-           leng += (UInt4) (strlen(appendq) + 1);
-       if (issue_begin)
-           leng += (UInt4) (lenbgncmd + 1);
-       if (query_rollback)
-       {
-           leng += (UInt4) (lensvpcmd + 1 + lenperqsvp + 1);
-           leng += (UInt4) (1 + lenrlscmd + 1 + lenperqsvp);
-       }
-       leng++;
-       SOCK_put_int(self->sock, leng + 4, 4);
-inolog("leng=%d\n", leng);
+       leng += (UInt4) (lensvpcmd + 1 + lenperqsvp + 1);
+       leng += (UInt4) (1 + lenrlscmd + 1 + lenperqsvp);
    }
+   leng++;
+   SOCK_put_int(sock, leng + 4, 4);
+inolog("leng=%d\n", leng);
+
    if (issue_begin)
    {
        SOCK_put_n_char(self->sock, bgncmd, lenbgncmd);
@@ -3085,10 +2898,7 @@ inolog("Discarded the first SAVEPOINT\n");
                    else if (strnicmp(cmdbuffer, rbkcmd, lenrbkcmd) == 0)
                    {
                        CC_mark_cursors_doubtful(self);
-                       if (PROTOCOL_74(&(self->connInfo)))
-                           CC_set_in_error_trans(self); /* mark the transaction error in case of manual rollback */
-                       else
-                           CC_on_abort(self, NO_TRANS);
+                       CC_set_in_error_trans(self); /* mark the transaction error in case of manual rollback */
                    }
                    /*
                     *  DROP TABLE or ALTER TABLE may change
@@ -3105,23 +2915,11 @@ inolog("Discarded the first SAVEPOINT\n");
                            res->recent_processed_row_count = atoi(ptr + 1);
                        else
                            res->recent_processed_row_count = -1;
-                       if (PROTOCOL_74(&(self->connInfo)))
+                       if (NULL != self->current_schema &&
+                           strnicmp(cmdbuffer, "SET", 3) == 0)
                        {
-                           if (NULL != self->current_schema &&
-                               strnicmp(cmdbuffer, "SET", 3) == 0)
-                           {
-                               if (is_setting_search_path(query))
-                                   reset_current_schema(self);
-                           }
-                       }
-                       else
-                       {
-                           if (strnicmp(cmdbuffer, cmtcmd, 6) == 0)
-                               CC_on_commit(self);
-                           else if (strnicmp(cmdbuffer, "END", 3) == 0)
-                               CC_on_commit(self);
-                           else if (strnicmp(cmdbuffer, "ABORT", 5) == 0)
-                               CC_on_abort(self, NO_TRANS);
+                           if (is_setting_search_path(query))
+                               reset_current_schema(self);
                        }
                    }
 
@@ -3130,23 +2928,7 @@ inolog("Discarded the first SAVEPOINT\n");
                    QR_set_command(res, cmdbuffer);
                    query_completed = TRUE;
                    mylog("send_query: returning res = %p\n", res);
-                   if (!beforeV2)
-                       break;
-
-                   /*
-                    * (Quotation from the original comments) since
-                    * backend may produce more than one result for some
-                    * commands we need to poll until clear so we send an
-                    * empty query, and keep reading out of the pipe until
-                    * an 'I' is received
-                    */
 
-                   if (empty_reqs == 0)
-                   {
-                       SOCK_put_string(self->sock, "Q ");
-                       SOCK_flush_output(self->sock);
-                       empty_reqs++;
-                   }
                }
                break;
            case 'Z':           /* Backend is ready for new query (6.4) */
@@ -3167,7 +2949,7 @@ inolog("Discarded the first SAVEPOINT\n");
 
            case 'I':           /* The server sends an empty query */
                /* There is a closing '\0' following the 'I', so we eat it */
-               if (PROTOCOL_74(ci) && 0 == response_length)
+               if (0 == response_length)
                    swallow = '\0';
                else
                    swallow = SOCK_get_char(self->sock);
@@ -3190,7 +2972,7 @@ inolog("Discarded the first SAVEPOINT\n");
                    if (--empty_reqs == 0)
                        query_completed = TRUE;
                }
-               else if (!beforeV2)
+               else
                    query_completed = TRUE;
                break;
            case 'E':
@@ -3377,14 +3159,6 @@ mylog("!!! copydata len=%d\n", response_length);
            break;
        if (CONN_DOWN == self->status)
            break;
-       /*
-        * There was no ReadyForQuery response before 6.4.
-        */
-       if (beforeV2)
-       {
-           if (empty_reqs == 0 && query_completed)
-               break;
-       }
    }
 
 cleanup:
@@ -3494,9 +3268,8 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
    int         ret = TRUE;
    UInt4           leng;
    Int4            response_length;
-   ConnInfo        *ci;
    int         func_cs_count = 0;
-   BOOL            sinceV3, beforeV3, beforeV2, resultResponse;
+   BOOL            resultResponse;
 
    mylog("send_function(): conn=%p, fnid=%d, result_is_int=%d, nargs=%d\n", self, fnid, result_is_int, nargs);
 
@@ -3525,32 +3298,24 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
    }
 #define    return DONT_CALL_RETURN_FROM_HERE???
    ENTER_INNER_CONN_CS(self, func_cs_count);
-   ci = &(self->connInfo);
-   sinceV3 = PROTOCOL_74(ci);
-   beforeV3 = (!sinceV3);
-   beforeV2 = (beforeV3 && !PROTOCOL_64(ci));
-   if (sinceV3)
-   {
-       leng = 4 + sizeof(uint32) + 2 + 2
-           + sizeof(uint16);
 
-       for (i = 0; i < nargs; i++)
+   leng = 4 + sizeof(uint32) + 2 + 2
+       + sizeof(uint16);
+
+   for (i = 0; i < nargs; i++)
+   {
+       leng += 4;
+       if (args[i].len >= 0)
        {
-           leng += 4;
-           if (args[i].len >= 0)
-           {
-               if (args[i].isint)
-                   leng += 4;
-               else
-                   leng += args[i].len;
-           }
+           if (args[i].isint)
+               leng += 4;
+           else
+               leng += args[i].len;
        }
-       leng += 2;
-       SOCK_put_char(sock, 'F');
-       SOCK_put_int(sock, leng, 4);
    }
-   else
-       SOCK_put_string(sock, "F ");
+   leng += 2;
+   SOCK_put_char(sock, 'F');
+   SOCK_put_int(sock, leng, 4);
    if (SOCK_get_errcode(sock) != 0)
    {
        CC_set_error(self, CONNECTION_COULD_NOT_SEND, "Could not send function to backend", func);
@@ -3560,14 +3325,9 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
    }
 
    SOCK_put_int(sock, fnid, 4);
-   if (sinceV3)
-   {
-       SOCK_put_int(sock, 1, 2); /* # of formats */
-       SOCK_put_int(sock, 1, 2); /* the format is binary */
-       SOCK_put_int(sock, nargs, 2);
-   }
-   else
-       SOCK_put_int(sock, nargs, 4);
+   SOCK_put_int(sock, 1, 2); /* # of formats */
+   SOCK_put_int(sock, 1, 2); /* the format is binary */
+   SOCK_put_int(sock, nargs, 2);
 
    mylog("send_function: done sending function\n");
 
@@ -3583,8 +3343,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
 
    }
 
-   if (sinceV3)
-       SOCK_put_int(sock, 1, 2); /* result format is binary */
+   SOCK_put_int(sock, 1, 2); /* result format is binary */
    mylog("    done sending args\n");
 
    SOCK_flush_output(sock);
@@ -3609,14 +3368,6 @@ inolog("send_func response_length=%d\n", response_length);
                    break;
                } /* fall through */
            case 'V':
-               if ('V' == id)
-               {
-                   if (beforeV3) /* FunctionResultResponse */
-                   {
-                       resultResponse = TRUE;
-                       break;
-                   }
-               }
                *actual_result_len = SOCK_get_int(sock, 4);
                if (-1 != *actual_result_len)
                {
@@ -3627,14 +3378,6 @@ inolog("send_func response_length=%d\n", response_length);
 
                    mylog("  after get result\n");
                }
-               if (beforeV3)
-               {
-                   SOCK_get_char(sock); /* get the last '0' */
-                   if (beforeV2)
-                       done = TRUE;
-                   resultResponse = FALSE;
-                   mylog("   after get 0\n");
-               }
                break;          /* ok */
 
            case 'N':
@@ -3651,8 +3394,6 @@ inolog("send_func response_length=%d\n", response_length);
 
                mylog("send_function(V): 'E' - %s\n", CC_get_errormsg(self));
                qlog("ERROR from backend during send_function: '%s'\n", CC_get_errormsg(self));
-               if (beforeV2)
-                   done = TRUE;
                ret = FALSE;
                break;
 
@@ -3664,8 +3405,6 @@ inolog("send_func response_length=%d\n", response_length);
            case '0':   /* empty result */
                if (resultResponse)
                {
-                   if (beforeV2)
-                       done = TRUE;
                    resultResponse = FALSE;
                    break;
                } /* fall through */
@@ -3734,27 +3473,11 @@ CC_setenv(ConnectionClass *self)
 
    }
 
-   /* KSQO (not applicable to 7.1+ - DJP 21/06/2002) */
-   if (ci->drivers.ksqo && PG_VERSION_LT(self, 7.1))
-   {
-       result = PGAPI_ExecDirect(hstmt, (SQLCHAR *) "set ksqo to 'ON'", SQL_NTS, 0);
-       if (!SQL_SUCCEEDED(result))
-           status = FALSE;
-
-       mylog("%s: result %d, status %d from set ksqo\n", func, result, status);
-
-   }
-
-   /* extra_float_digits (applicable since 7.4) */
-   if (PG_VERSION_GT(self, 7.3))
-   {
-       result = PGAPI_ExecDirect(hstmt, (SQLCHAR *) "set extra_float_digits to 2", SQL_NTS, 0);
-       if (!SQL_SUCCEEDED(result))
-           status = FALSE;
-
-       mylog("%s: result %d, status %d from set extra_float_digits\n", func, result, status);
+   result = PGAPI_ExecDirect(hstmt, (SQLCHAR *) "set extra_float_digits to 2", SQL_NTS, 0);
+   if (!SQL_SUCCEEDED(result))
+       status = FALSE;
 
-   }
+   mylog("%s: result %d, status %d from set extra_float_digits\n", func, result, status);
 
    PGAPI_FreeStmt(hstmt, SQL_DROP);
 
@@ -3875,12 +3598,8 @@ CC_lookup_lo(ConnectionClass *self)
 
    mylog("%s: entering...\n", func);
 
-   if (PG_VERSION_GE(self, 7.4))
-       res = CC_send_query(self, "select oid, typbasetype from pg_type where typname = '"  PG_TYPE_LO_NAME "'",
-           NULL, IGNORE_ABORT_ON_CONN | ROLLBACK_ON_ERROR, NULL);
-   else
-       res = CC_send_query(self, "select oid, 0 from pg_type where typname='" PG_TYPE_LO_NAME "'",
-           NULL, IGNORE_ABORT_ON_CONN | ROLLBACK_ON_ERROR, NULL);
+   res = CC_send_query(self, "select oid, typbasetype from pg_type where typname = '"  PG_TYPE_LO_NAME "'",
+       NULL, IGNORE_ABORT_ON_CONN | ROLLBACK_ON_ERROR, NULL);
    if (QR_command_maybe_successful(res) && QR_get_num_cached_tuples(res) > 0)
    {
        OID basetype;
@@ -3907,102 +3626,10 @@ CC_lookup_lo(ConnectionClass *self)
 void
 CC_initialize_pg_version(ConnectionClass *self)
 {
-   strncpy_null(self->pg_version, self->connInfo.protocol, sizeof(self->pg_version));
-   if (PROTOCOL_62(&self->connInfo))
-   {
-       self->pg_version_number = (float) 6.2;
-       self->pg_version_major = 6;
-       self->pg_version_minor = 2;
-   }
-   else if (PROTOCOL_63(&self->connInfo))
-   {
-       self->pg_version_number = (float) 6.3;
-       self->pg_version_major = 6;
-       self->pg_version_minor = 3;
-   }
-   else if (PROTOCOL_64(&self->connInfo))
-   {
-       self->pg_version_number = (float) 6.4;
-       self->pg_version_major = 6;
-       self->pg_version_minor = 4;
-   }
-   else
-   {
-       self->pg_version_number = (float) 7.4;
-       self->pg_version_major = 7;
-       self->pg_version_minor = 4;
-   }
-}
-
-
-/*
- * This function gets the version of PostgreSQL that we're connected to.
- * This is used to return the correct info in SQLGetInfo
- * DJP - 25-1-2001
- */
-static void
-CC_lookup_pg_version(ConnectionClass *self)
-{
-   HSTMT       hstmt;
-   RETCODE     result;
-   char        szVersion[32];
-   int         major,
-               minor;
-   CSTR        func = "CC_lookup_pg_version";
-
-   mylog("%s: entering...\n", func);
-
-/*
- * This function must use the local odbc API functions since the odbc state
- * has not transitioned to "connected" yet.
- */
-   result = PGAPI_AllocStmt(self, &hstmt, 0);
-   if (!SQL_SUCCEEDED(result))
-       return;
-
-   /* get the server's version if possible  */
-   result = PGAPI_ExecDirect(hstmt, (SQLCHAR *) "select version()", SQL_NTS, 0);
-   if (!SQL_SUCCEEDED(result))
-   {
-       PGAPI_FreeStmt(hstmt, SQL_DROP);
-       return;
-   }
-
-   result = PGAPI_Fetch(hstmt);
-   if (!SQL_SUCCEEDED(result))
-   {
-       PGAPI_FreeStmt(hstmt, SQL_DROP);
-       return;
-   }
-
-   result = PGAPI_GetData(hstmt, 1, SQL_C_CHAR, self->pg_version, MAX_INFO_STRING, NULL);
-   if (!SQL_SUCCEEDED(result))
-   {
-       PGAPI_FreeStmt(hstmt, SQL_DROP);
-       return;
-   }
-
-   /*
-    * Extract the Major and Minor numbers from the string. This assumes
-    * the string starts 'Postgresql X.X'
-    */
-   strcpy(szVersion, "0.0");
-   if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2)
-   {
-       snprintf(szVersion, sizeof(szVersion), "%d.%d", major, minor);
-       self->pg_version_major = major;
-       self->pg_version_minor = minor;
-   }
-   self->pg_version_number = (float) atof(szVersion);
-   if (PG_VERSION_GE(self, 7.3))
-       self->schema_support = 1;
-
-   mylog("Got the PostgreSQL version string: '%s'\n", self->pg_version);
-   mylog("Extracted PostgreSQL version number: '%1.1f'\n", self->pg_version_number);
-   qlog("    [ PostgreSQL version string = '%s' ]\n", self->pg_version);
-   qlog("    [ PostgreSQL version number = '%1.1f' ]\n", self->pg_version_number);
-
-   PGAPI_FreeStmt(hstmt, SQL_DROP);
+   strcpy(self->pg_version, "7.4");
+   self->pg_version_number = (float) 7.4;
+   self->pg_version_major = 7;
+   self->pg_version_minor = 4;
 }
 
 
@@ -4026,7 +3653,7 @@ CC_log_error(const char *func, const char *desc, const ConnectionClass *self)
        {
            SocketClass *sock = self->sock;
 
-           qlog("            socket=%d, reverse=%d, errornumber=%d, errormsg='%s'\n", sock->socket, sock->reverse, sock->errornumber, nullcheck(SOCK_get_errmsg(sock)));
+           qlog("            socket=%d, errornumber=%d, errormsg='%s'\n", sock->socket, sock->errornumber, nullcheck(SOCK_get_errmsg(sock)));
            qlog("            buffer_in=%u, buffer_out=%u\n", sock->buffer_in, sock->buffer_out);
            qlog("            buffer_filled_in=%d, buffer_filled_out=%d, buffer_read_in=%d\n", sock->buffer_filled_in, sock->buffer_filled_out, sock->buffer_read_in);
        }
@@ -4039,23 +3666,6 @@ CC_log_error(const char *func, const char *desc, const ConnectionClass *self)
 #undef PRN_NULLCHECK
 }
 
-int
-CC_get_max_query_len(const ConnectionClass *conn)
-{
-   int         value;
-
-   /* Long Queries in 7.0+ */
-   if (PG_VERSION_GE(conn, 7.0))
-       value = 0 /* MAX_STATEMENT_LEN */ ;
-   /* Prior to 7.0 we used 2*BLCKSZ */
-   else if (PG_VERSION_GE(conn, 6.5))
-       value = (2 * BLCKSZ);
-   else
-       /* Prior to 6.5 we used BLCKSZ */
-       value = BLCKSZ;
-   return value;
-}
-
 /*
  * This doesn't really return the CURRENT SCHEMA
  * but there's no alternative.
@@ -4063,7 +3673,7 @@ CC_get_max_query_len(const ConnectionClass *conn)
 const char *
 CC_get_current_schema(ConnectionClass *conn)
 {
-   if (!conn->current_schema && conn->schema_support)
+   if (!conn->current_schema)
    {
        QResultClass    *res;
 
@@ -4288,20 +3898,16 @@ inolog("ssl=%p\n", sock->ssl);
    if (TRUE)
    {
        int pversion;
-       ConnInfo    *ci = &self->connInfo;
 
-       sock->pversion = PG_PROTOCOL_74;
-       strncpy_null(ci->protocol, PG74, sizeof(ci->protocol));
+       sock->pversion = PG_PROTOCOL_LATEST;
        pversion = PQprotocolVersion(pqconn);
-       switch (pversion)
+       if (pversion < 3)
        {
-           case 2:
-               sock->pversion = PG_PROTOCOL_64;
-               strncpy_null(ci->protocol, PG64, sizeof(ci->protocol));
-               break;
+           mylog("Protocol version %d is not supported\n", pversion);
+           goto cleanup1;
        }
+       mylog("protocol=%d\n", pversion);
    }
-   mylog("protocol=%s\n", self->connInfo.protocol);
    {
        int pversion;
        const char *conforming_strings;
@@ -4311,8 +3917,6 @@ inolog("ssl=%p\n", sock->ssl);
        self->pg_version_minor = (pversion % 10000) / 100;
        sprintf(self->pg_version, "%d.%d.%d",  self->pg_version_major, self->pg_version_minor, pversion % 100);
        self->pg_version_number = (float) atof(self->pg_version);
-       if (PG_VERSION_GE(self, 7.3))
-           self->schema_support = 1;
        if (conforming_strings = PQparameterStatus(pqconn, std_cnf_strs), NULL != conforming_strings)
        {
            if (stricmp(conforming_strings, "on") == 0)
@@ -4382,10 +3986,7 @@ const char *CurrCat(const ConnectionClass *conn)
     */
    if (isMsQuery())    /* MS Query */
        return NULL;
-   else if (conn->schema_support)
-       return conn->connInfo.database;
-   else
-       return NULL;
+   return conn->connInfo.database;
 }
 
 const char *CurrCatString(const ConnectionClass *conn)
@@ -4458,7 +4059,7 @@ DLL_DECLARE void PgDtc_create_connect_string(void *self, char *connstr, int strs
    if (0 >= ci->xa_opt)    return;
    switch (ci->xa_opt)
    {
-       case DTC_CHECK_LINK_ONLY: 
+       case DTC_CHECK_LINK_ONLY:
        case DTC_CHECK_BEFORE_LINK:
            sprintf(xaOptStr, KEYWORD_DTC_CHECK "=0;");
            break;
@@ -4477,7 +4078,7 @@ DLL_DECLARE void PgDtc_create_connect_string(void *self, char *connstr, int strs
 #endif /* USE_LIBPQ */
        ,
 
-       drivername, xaOptStr 
+       drivername, xaOptStr
        , ci->server, ci->port, ci->database, ci->username, SAFE_NAME(ci->password), ci->sslmode
 #ifdef USE_LIBPQ
        , (CC_get_socket(conn))->via_libpq
@@ -4584,25 +4185,25 @@ DLL_DECLARE int PgDtc_is_recovery_available(void *self, char *reason, int rsize)
    }
 #endif /* USE_LIBPQ */
 
-   ret = 1;    
+   ret = 1;
    if (outReason)
        *reason = '\0';
    delim = "";
-   if (doubtRootCert) 
+   if (doubtRootCert)
    {
        if (outReason)
            snprintf(reason, rsize, "%s%ssslmode verify-[ca|full]", reason, delim);
        delim = ", ";
        ret = -1;
    }
-   if (doubtCert) 
+   if (doubtCert)
    {
        if (outReason)
            snprintf(reason, rsize, "%s%scertificate", reason, delim);
        delim = ", ";
        ret = -1;
    }
-   if (doubtCert) 
+   if (doubtCert)
    {
        if (outReason)
            snprintf(reason, rsize, "%s%ssspi", reason, delim);
index 2e7bd74f76064e71fac1eb5c90637f1ac0fb4477..a9c1be09305b569116e0025748957e1cb9cfdb09 100644 (file)
@@ -221,48 +221,14 @@ do { \
 #define SM_UNUSED      64
 #define SM_TTY         64
 
-/* Old 6.2 protocol defines */
-#define NO_AUTHENTICATION  7
-#define PATH_SIZE      64
-#define ARGV_SIZE      64
-#define USRNAMEDATALEN     16
-
 typedef unsigned int ProtocolVersion;
 
 #define PG_PROTOCOL(major, minor)  (((major) << 16) | (minor))
 #define PG_PROTOCOL_LATEST PG_PROTOCOL(3, 0)
-#define PG_PROTOCOL_74 PG_PROTOCOL(3, 0)
-#define PG_PROTOCOL_64 PG_PROTOCOL(2, 0)
-#define PG_PROTOCOL_63 PG_PROTOCOL(1, 0)
-#define PG_PROTOCOL_62 PG_PROTOCOL(0, 0)
 #define PG_NEGOTIATE_SSLMODE   PG_PROTOCOL(1234, 5679)
 
-/* This startup packet is to support latest Postgres protocol (6.4, 6.3) */
-typedef struct _StartupPacket
-{
-   ProtocolVersion protoVersion;
-   char        database[SM_DATABASE];
-   char        user[SM_USER];
-   char        options[SM_OPTIONS];
-   char        unused[SM_UNUSED];
-   char        tty[SM_TTY];
-} StartupPacket;
-
-
-/* This startup packet is to support pre-Postgres 6.3 protocol */
-typedef struct _StartupPacket6_2
-{
-   unsigned int authtype;
-   char        database[PATH_SIZE];
-   char        user[USRNAMEDATALEN];
-   char        options[ARGV_SIZE];
-   char        execfile[ARGV_SIZE];
-   char        tty[PATH_SIZE];
-} StartupPacket6_2;
-
 /* Transferred from pqcomm.h:  */
 
-
 typedef ProtocolVersion MsgType;
 
 #define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678)
@@ -287,7 +253,6 @@ typedef struct
    char        database[MEDIUM_REGISTRY_LEN];
    char        username[MEDIUM_REGISTRY_LEN];
    pgNAME      password;
-   char        protocol[SMALL_REGISTRY_LEN];
    char        port[SMALL_REGISTRY_LEN];
    char        sslmode[16];
    char        onlyread[SMALL_REGISTRY_LEN];
@@ -330,22 +295,11 @@ typedef struct
    GLOBAL_VALUES drivers;      /* moved from driver's option */
 } ConnInfo;
 
-/* Macro to determine is the connection using 6.2 protocol? */
-#define PROTOCOL_62(conninfo_)     (strncmp((conninfo_)->protocol, PG62, strlen(PG62)) == 0)
-
-/* Macro to determine is the connection using 6.3 protocol? */
-#define PROTOCOL_63(conninfo_)     (strncmp((conninfo_)->protocol, PG63, strlen(PG63)) == 0)
-
-/* Macro to determine is the connection using 6.4 protocol? */
-#define PROTOCOL_64(conninfo_)     (strncmp((conninfo_)->protocol, PG64, strlen(PG64)) == 0)
-
-/* Macro to determine is the connection using 7.4 protocol? */
-#define PROTOCOL_74(conninfo_)     (strncmp((conninfo_)->protocol, PG74, strlen(PG74)) == 0)
-
 /* Macro to determine is the connection using 7.4 rejected? */
 #define PROTOCOL_74REJECTED(conninfo_) (strncmp((conninfo_)->protocol, PG74REJECTED, strlen(PG74REJECTED)) == 0)
 
-#define SUPPORT_DESCRIBE_PARAM(conninfo_) (PROTOCOL_74(conninfo_) && conninfo_->use_server_side_prepare)
+#define SUPPORT_DESCRIBE_PARAM(conninfo_) (conninfo_->use_server_side_prepare)
+
 /*
  * Macros to compare the server's version with a specified version
  *     1st parameter: pointer to a ConnectionClass object
@@ -360,13 +314,8 @@ typedef struct
    ((conn)->pg_version_major == major && (conn)->pg_version_minor >= minor))
 #define SERVER_VERSION_EQ(conn, major, minor) \
    ((conn)->pg_version_major == major && (conn)->pg_version_minor == minor)
-#define SERVER_VERSION_LE(conn, major, minor) (! SERVER_VERSION_GT(conn, major, minor))
-#define SERVER_VERSION_LT(conn, major, minor) (! SERVER_VERSION_GE(conn, major, minor))
-/*#if ! defined(HAVE_CONFIG_H) || defined(HAVE_STRINGIZE)*/
 #define STRING_AFTER_DOT(string)   (strchr(#string, '.') + 1)
-/*#else
-#define STRING_AFTER_DOT(str)  (strchr("str", '.') + 1)
-#endif*/
+
 /*
  * Simplified macros to compare the server's version with a
  *     specified version
@@ -385,7 +334,6 @@ typedef struct
 /* This is used to store cached table information in the connection */
 struct col_info
 {
-   Int2        num_reserved_cols;
    Int2        refcnt;
    QResultClass    *result;
    pgNAME      schema_name;
@@ -462,7 +410,6 @@ struct ConnectionClass_
    char        ms_jet;
    char        unicode;
    char        result_uncommitted;
-   char        schema_support;
    char        lo_is_domain;
    char        escape_in_literal;
    char        *original_client_encoding;
@@ -512,7 +459,7 @@ struct ConnectionClass_
 #define CC_is_onlyread(x)          (x->connInfo.onlyread[0] == '1')
 #define CC_get_escape(x)           (x->escape_in_literal)
 #define CC_fake_mss(x) (/* 0 != (x)->ms_jet && */ 0 < (x)->connInfo.fake_mss)
-#define CC_accessible_only(x)  (0 < (x)->connInfo.accessible_only && PG_VERSION_GE((x), 7.2))
+#define CC_accessible_only(x)  (0 < (x)->connInfo.accessible_only)
 #define CC_default_is_c(x) (CC_is_in_ansi_app(x) || x->ms_jet /* not only */ || TRUE /* but for any other ? */)
 /* for CC_DSN_info */
 #define CONN_DONT_OVERWRITE        0
@@ -581,8 +528,7 @@ void        CC_lookup_pg_version(ConnectionClass *conn);
 */
 void       CC_initialize_pg_version(ConnectionClass *conn);
 void       CC_log_error(const char *func, const char *desc, const ConnectionClass *self);
-int        CC_get_max_query_len(const ConnectionClass *self);
-int        CC_send_cancel_request(const ConnectionClass *conn);
+int            CC_send_cancel_request(const ConnectionClass *conn);
 void       CC_on_commit(ConnectionClass *conn);
 void       CC_on_abort(ConnectionClass *conn, UDWORD opt);
 void       CC_on_abort_partial(ConnectionClass *conn);
index 5003a3e540d4c2e943e2d1160f1a78c78266735d..e0165e3a24fc591945deb8b9a18a1d1c3e061df6 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -990,7 +990,7 @@ mylog("null_cvt_date_string=%d\n", conn->connInfo.cvt_null_date_string);
            }
            if (strnicmp(value, "invalid", 7) != 0)
            {
-               BOOL        bZone = (field_type != PG_TYPE_TIMESTAMP_NO_TMZONE && PG_VERSION_GE(conn, 7.2));
+               BOOL        bZone = field_type != PG_TYPE_TIMESTAMP_NO_TMZONE;
                int         zone;
 
                /*
@@ -1065,8 +1065,6 @@ inolog("2stime fr=%d\n", std_time.fr);
                    if (sscanf(vp, "%hi", &shortv) != 1)
                        break;
                    mylog(" %hi", shortv);
-                   if (0 == shortv && PG_VERSION_LT(conn, 7.2))
-                       break;
                    nval++;
                    if (nval < maxc)
                        short_array[i + 1] = shortv;
@@ -1192,7 +1190,7 @@ inolog("2stime fr=%d\n", std_time.fr);
                /* sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
                    std_time.y, std_time.m, std_time.d, std_time.hh, std_time.mm, std_time.ss); */
                len = stime2timestamp(&std_time, rgbValueBindRow, cbValueMax, FALSE,
-                               PG_VERSION_GE(conn, 7.2) ? (int) cbValueMax - len - 2 : 0);
+                                     (int) cbValueMax - len - 2 );
                if (len + 1 > cbValueMax)
                    result = COPY_RESULT_TRUNCATED;
                break;
@@ -1916,7 +1914,7 @@ typedef struct _QueryParse {
 static void
 QP_initialize(QueryParse *q, const StatementClass *stmt)
 {
-   q->statement = stmt->execute_statement ? stmt->execute_statement : stmt->statement;
+   q->statement = stmt->statement;
    q->statement_type = stmt->statement_type;
    q->opos = 0;
    q->from_pos = -1;
@@ -1938,7 +1936,6 @@ QP_initialize(QueryParse *q, const StatementClass *stmt)
 #define    FLGB_PRE_EXECUTING  1L
 #define    FLGB_BUILDING_PREPARE_STATEMENT (1L << 1)
 #define    FLGB_BUILDING_BIND_REQUEST  (1L << 2)
-#define    FLGB_EXECUTE_PREPARED       (1L << 3)
 
 #define    FLGB_INACCURATE_RESULT  (1L << 4)
 #define    FLGB_CREATE_KEYSET  (1L << 5)
@@ -1950,7 +1947,6 @@ QP_initialize(QueryParse *q, const StatementClass *stmt)
 #define    FLGB_HEX_BIN_FORMAT (1L << 11)
 typedef struct _QueryBuild {
    char   *query_statement;
-   size_t  str_size_limit;
    size_t  str_alsize;
    size_t  npos;
    SQLLEN  current_row;
@@ -2028,22 +2024,10 @@ QB_initialize(QueryBuild *qb, size_t size, StatementClass *stmt, ConnectionClass
    if (PG_VERSION_GE(qb->conn, 9.0))
        qb->flags |= FLGB_HEX_BIN_FORMAT;
 
-   if (stmt)
-       qb->str_size_limit = stmt->stmt_size_limit;
-   else
-       qb->str_size_limit = -1;
-   if (qb->str_size_limit > 0)
-   {
-       if (size > qb->str_size_limit)
-           return -1;
-       newsize = qb->str_size_limit;
-   }
-   else
-   {
-       newsize = INIT_MIN_ALLOC;
-       while (newsize <= size)
-           newsize *= 2;
-   }
+   newsize = INIT_MIN_ALLOC;
+   while (newsize <= size)
+       newsize *= 2;
+
    if ((qb->query_statement = malloc(newsize)) == NULL)
    {
        qb->str_alsize = 0;
@@ -2066,11 +2050,6 @@ QB_initialize_copy(QueryBuild *qb_to, const QueryBuild *qb_from, UInt4 size)
 {
    memcpy(qb_to, qb_from, sizeof(QueryBuild));
 
-   if (qb_to->str_size_limit > 0)
-   {
-       if (size > qb_to->str_size_limit)
-           return -1;
-   }
    if ((qb_to->query_statement = malloc(size)) == NULL)
    {
        qb_to->str_alsize = 0;
@@ -2161,22 +2140,6 @@ enlarge_query_statement(QueryBuild *qb, size_t newsize)
    size_t  newalsize = INIT_MIN_ALLOC;
    CSTR func = "enlarge_statement";
 
-   if (qb->str_size_limit > 0 && qb->str_size_limit < (int) newsize)
-   {
-       free(qb->query_statement);
-       qb->query_statement = NULL;
-       qb->str_alsize = 0;
-       if (qb->stmt)
-       {
-           SC_set_error(qb->stmt, STMT_EXEC_ERROR, "Query buffer overflow in copy_statement_with_parameters", func);
-       }
-       else
-       {
-           qb->errormsg = "Query buffer overflow in copy_statement_with_parameters";
-           qb->errornumber = STMT_EXEC_ERROR;
-       }
-       return -1;
-   }
    while (newalsize <= newsize)
        newalsize *= 2;
    if (!(qb->query_statement = realloc(qb->query_statement, newalsize)))
@@ -2558,139 +2521,17 @@ RETCODE    prep_params(StatementClass *stmt, QueryParse *qp, QueryBuild *qb, BOOL s
 static int
 Prepare_and_convert(StatementClass *stmt, QueryParse *qp, QueryBuild *qb)
 {
-   CSTR func = "Prepare_and_convert";
-   char    *exe_statement = NULL;
-   RETCODE retval;
-   ConnectionClass *conn = SC_get_conn(stmt);
-   ConnInfo    *ci = &(conn->connInfo);
-   BOOL    discardOutput, outpara;
-
-   if (PROTOCOL_74(ci))
+   switch (stmt->prepared)
    {
-       switch (stmt->prepared)
-       {
-           case NOT_YET_PREPARED:
-           case ONCE_DESCRIBED:
-               break;
-           default:
-               return SQL_SUCCESS;
-       }
+       case NOT_YET_PREPARED:
+       case ONCE_DESCRIBED:
+           break;
+       default:
+           return SQL_SUCCESS;
    }
    if (QB_initialize(qb, qp->stmt_len, stmt, NULL) < 0)
        return SQL_ERROR;
-   if (PROTOCOL_74(ci))
-       return prep_params(stmt, qp, qb, FALSE);
-   discardOutput = (0 != (qb->flags & FLGB_DISCARD_OUTPUT));
-   if (NOT_YET_PREPARED == stmt->prepared) /*  not yet prepared */
-   {
-       ssize_t elen;
-       int i, oc;
-       SQLSMALLINT marker_count;
-       const IPDFields *ipdopts = qb->ipdopts;
-       char    plan_name[32];
-
-       qb->flags |= FLGB_BUILDING_PREPARE_STATEMENT;
-       sprintf(plan_name, "_PLAN%p", stmt);
-#ifdef NOT_USED
-       new_statement = qb->query_statement;
-       sprintf(new_statement, "PREPARE \"%s\"", plan_name);
-       qb->npos = strlen(new_statement);
-#endif /* NOT_USED */
-       CVT_APPEND_STR(qb, "PREPARE \"");
-       CVT_APPEND_STR(qb, plan_name);
-       CVT_APPEND_CHAR(qb, IDENTIFIER_QUOTE);
-       marker_count = stmt->num_params - qb->num_discard_params;
-       if (!ipdopts || ipdopts->allocated < marker_count)
-       {
-           SC_set_error(stmt, STMT_COUNT_FIELD_INCORRECT,
-               "The # of binded parameters < the # of parameter markers", func);
-           retval = SQL_ERROR;
-           goto cleanup;
-       }
-       if (marker_count > 0)
-       {
-           CVT_APPEND_CHAR(qb, '(');
-           for (i = qb->proc_return, oc = 0; i < stmt->num_params; i++)
-           {
-               outpara = FALSE;
-               if (i < ipdopts->allocated &&
-                   SQL_PARAM_OUTPUT == ipdopts->parameters[i].paramType)
-               {
-                   outpara = TRUE;
-                   if (discardOutput)
-                       continue;
-               }
-               if (oc > 0)
-                   CVT_APPEND_STR(qb, ", ");
-               if (outpara)
-                   CVT_APPEND_STR(qb, "void");
-               else
-                   CVT_APPEND_STR(qb, pgtype_to_name(stmt, PIC_dsp_pgtype(conn, ipdopts->parameters[i]), -1, FALSE));
-               oc++;
-           }
-           CVT_APPEND_CHAR(qb, ')');
-       }
-       CVT_APPEND_STR(qb, " as ");
-       for (qp->opos = 0; qp->opos < qp->stmt_len; qp->opos++)
-       {
-           retval = inner_process_tokens(qp, qb);
-           if (SQL_ERROR == retval)
-               goto cleanup;
-       }
-       CVT_APPEND_CHAR(qb, ';');
-       /* build the execute statement */
-       exe_statement = malloc(30 + 2 * marker_count);
-       sprintf(exe_statement, "EXECUTE \"%s\"", plan_name);
-       if (marker_count > 0)
-       {
-           elen = strlen(exe_statement);
-           exe_statement[elen++] = '(';
-           for (i = 0; i < marker_count; i++)
-           {
-               if (i > 0)
-                   exe_statement[elen++] = ',';
-               exe_statement[elen++]  = '?';
-           }
-           exe_statement[elen++] = ')';
-           exe_statement[elen] = '\0';
-       }
-inolog("exe_statement=%s\n", exe_statement);
-       stmt->execute_statement = exe_statement;
-       QP_initialize(qp, stmt);
-       SC_set_planname(stmt, plan_name);
-   }
-   qb->flags &= FLGB_DISCARD_OUTPUT;
-   qb->flags |= FLGB_EXECUTE_PREPARED;
-   qb->param_number = -1;
-   for (qp->opos = 0; qp->opos < qp->stmt_len; qp->opos++)
-   {
-       retval = inner_process_tokens(qp, qb);
-       if (SQL_ERROR == retval)
-           goto cleanup;
-   }
-   /* make sure new_statement is always null-terminated */
-   CVT_TERMINATE(qb);
-   retval = SQL_SUCCESS;
-
-cleanup:
-   if (SQL_SUCCEEDED(retval))
-   {
-       if (exe_statement)
-           SC_set_concat_prepare_exec(stmt);
-       stmt->stmt_with_params = qb->query_statement;
-       qb->query_statement = NULL;
-   }
-   else
-   {
-       QB_replace_SC_error(stmt, qb, func);
-       if (exe_statement)
-       {
-           free(exe_statement);
-           stmt->execute_statement = NULL;
-       }
-       QB_Destructor(qb);
-   }
-   return retval;
+   return prep_params(stmt, qp, qb, FALSE);
 }
 
 #define        my_strchr(conn, s1,c1) pg_mbschr(conn->ccsc, s1,c1)
@@ -2970,9 +2811,8 @@ inolog("type=%d concur=%d\n", stmt->options.cursor_type, stmt->options.scroll_co
        if (prepare_dummy_cursor)
        {
            SC_set_fetchcursor(stmt);
-           if (PG_VERSION_GE(conn, 7.4))
-                   opt_scroll = " scroll";
-           if (!CC_is_in_trans(conn) && PG_VERSION_GE(conn, 7.1))
+           opt_scroll = " scroll";
+           if (!CC_is_in_trans(conn))
            {
                strcpy(new_statement, "BEGIN;");
                begin_first = TRUE;
@@ -2985,11 +2825,8 @@ inolog("type=%d concur=%d\n", stmt->options.cursor_type, stmt->options.scroll_co
            SC_set_fetchcursor(stmt);
            if (SC_is_with_hold(stmt))
                opt_hold = " with hold";
-           if (PG_VERSION_GE(conn, 7.4))
-           {
-               if (SQL_CURSOR_FORWARD_ONLY != stmt->options.cursor_type)
-                   opt_scroll = " scroll";
-           }
+           if (SQL_CURSOR_FORWARD_ONLY != stmt->options.cursor_type)
+               opt_scroll = " scroll";
        }
        if (SC_is_fetchcursor(stmt))
        {
@@ -4063,21 +3900,6 @@ mylog("!!! The # of binded parameters (%d, %d) < the # of parameter markers %d\n
        CVT_TERMINATE(qb);  /* just in case */
        return SQL_ERROR;
    }
-   if (0 != (qb->flags & FLGB_EXECUTE_PREPARED)
-       && (outputDiscard || param_number < qb->proc_return)
-           )
-   {
-       while (ipara && SQL_PARAM_OUTPUT == ipara->paramType)
-       {
-           apara = NULL;
-           ipara = NULL;
-           param_number = ++qb->param_number;
-           if (param_number < apdopts->allocated)
-               apara = apdopts->parameters + param_number;
-           if (param_number < ipdopts->allocated)
-               ipara = ipdopts->parameters + param_number;
-       }
-   }
 
 inolog("ipara=%p paramType=%d %d proc_return=%d\n", ipara, ipara ? ipara->paramType : -1, PG_VERSION_LT(conn, 8.1), qb->proc_return);
    if (param_number < qb->proc_return)
@@ -4665,7 +4487,7 @@ mylog("buf=%p flag=%d\n", buf, qb->flags);
             * st.m, st.d, st.hh, st.mm, st.ss);
             */
            /* Time zone stuff is unreliable */
-           stime2timestamp(&st, tmp, sizeof(tmp), USE_ZONE, PG_VERSION_GE(conn, 7.2) ? 6 : 0);
+           stime2timestamp(&st, tmp, sizeof(tmp), USE_ZONE, 6);
            lastadd = "::timestamp";
            CVT_APPEND_STR(qb, tmp);
 
@@ -4986,7 +4808,6 @@ static int
 convert_escape(QueryParse *qp, QueryBuild *qb)
 {
    CSTR func = "convert_escape";
-   ConnectionClass *conn = qb->conn;
    RETCODE retval = SQL_SUCCESS;
    char        buf[1024], buf_small[128], key[65];
    UCHAR   ucv;
@@ -5018,44 +4839,6 @@ convert_escape(QueryParse *qp, QueryBuild *qb)
        }
        while (isspace((UCHAR) qp->statement[++qp->opos]));
    }
-   /**
-   if (qp->statement_type == STMT_TYPE_PROCCALL)
-   {
-       int lit_call_len = 4;
-
-       // '?=' to accept return values exists ?
-       if (F_OldChar(qp) == '?')
-       {
-           qb->param_number++;
-           qb->proc_return = 1;
-           if (qb->stmt)
-               qb->stmt->proc_return = 1;
-           while (isspace((UCHAR) qp->statement[++qp->opos]));
-           if (F_OldChar(qp) != '=')
-           {
-               F_OldPrior(qp);
-               return SQL_SUCCESS;
-           }
-           while (isspace((UCHAR) qp->statement[++qp->opos]));
-       }
-       if (strnicmp(F_OldPtr(qp), "call", lit_call_len) ||
-           !isspace((UCHAR) F_OldPtr(qp)[lit_call_len]))
-       {
-           F_OldPrior(qp);
-           return SQL_SUCCESS;
-       }
-       qp->opos += lit_call_len;
-       if (qb->num_io_params > 1 ||
-           (0 == qb->proc_return &&
-            PG_VERSION_GE(conn, 7.3)))
-           CVT_APPEND_STR(qb, "SELECT * FROM");
-       else
-           CVT_APPEND_STR(qb, "SELECT");
-       if (my_strchr(conn, F_OldPtr(qp), '('))
-           qp->proc_no_param = FALSE;
-       return SQL_SUCCESS;
-   }
-   **/
 
    sscanf(F_OldPtr(qp), "%32s", key);
    while ((ucv = F_OldChar(qp)) != '\0' && (!isspace(ucv)))
@@ -5076,8 +4859,7 @@ convert_escape(QueryParse *qp, QueryBuild *qb)
            goto cleanup;
        }
        if (qb->num_io_params > 1 ||
-           (0 == qb->proc_return &&
-            PG_VERSION_GE(conn, 7.3)))
+           (0 == qb->proc_return))
            CVT_APPEND_STR(qb, "SELECT * FROM ");
        else
            CVT_APPEND_STR(qb, "SELECT ");
@@ -5105,10 +4887,7 @@ convert_escape(QueryParse *qp, QueryBuild *qb)
    {
        /* Literal; return the escape part adding type cast */
        F_ExtractOldTo(qp, buf_small, ODBC_ESCAPE_END, sizeof(buf_small));
-       if (PG_VERSION_LT(conn, 7.3))
-           prtlen = snprintf(buf, sizeof(buf), "%s", buf_small);
-       else
-           prtlen = snprintf(buf, sizeof(buf), "%s::date", buf_small);
+       prtlen = snprintf(buf, sizeof(buf), "%s::date", buf_small);
        CVT_APPEND_DATA(qb, buf, prtlen);
        retval = QB_append_space_to_separate_identifiers(qb, qp);
    }
@@ -5124,10 +4903,7 @@ convert_escape(QueryParse *qp, QueryBuild *qb)
    {
        /* Literal; return the escape part adding type cast */
        F_ExtractOldTo(qp, buf_small, ODBC_ESCAPE_END, sizeof(buf_small));
-       if (PG_VERSION_LT(conn, 7.1))
-           prtlen = snprintf(buf, sizeof(buf), "%s::datetime", buf_small);
-       else
-           prtlen = snprintf(buf, sizeof(buf), "%s::timestamp", buf_small);
+       prtlen = snprintf(buf, sizeof(buf), "%s::timestamp", buf_small);
        CVT_APPEND_DATA(qb, buf, prtlen);
        retval = QB_append_space_to_separate_identifiers(qb, qp);
    }
index 1cebab90ba8a8d3c0979223db03586d8919a7b5b..f214b6395b3fc2fc5924dd8a3e5b0f6b368be8a4 100644 (file)
@@ -28,16 +28,6 @@ void TI_Constructor(TABLE_INFO *self, const ConnectionClass *conn)
 {
    memset(self, 0, sizeof(TABLE_INFO));
    TI_set_updatable(self);
-   if (PG_VERSION_LT(conn, 7.2))
-   {
-       char    qual[32];
-
-       STR_TO_NAME(self->bestitem, OID_NAME);
-       sprintf(qual, "\"%s\" = %%u", OID_NAME);
-       STRX_TO_NAME(self->bestqual, qual);
-       TI_set_hasoids(self);
-       TI_set_hasoids_checked(self);
-   }
 }
 void   TI_Destructor(TABLE_INFO **ti, int count)
 {
index cf6852b86a3ce56699654739de78ce3331a6cf38..8c5a694e566f28b2bb2f084837737dd1752e1fc8 100644 (file)
@@ -305,9 +305,9 @@ inolog("hlen=%d", hlen);
        char    protocol_and[16];
 
        if (ci->rollback_on_error >= 0)
-           snprintf(protocol_and, sizeof(protocol_and), "%s-%d", ci->protocol, ci->rollback_on_error);
+           snprintf(protocol_and, sizeof(protocol_and), "7.4-%d", ci->rollback_on_error);
        else
-           strncpy_null(protocol_and, ci->protocol, sizeof(protocol_and));
+           strcpy(protocol_and, "7.4");
        olen = snprintf(&connect_string[hlen], nlen, ";"
            INI_SSLMODE "=%s;"
            INI_READONLY "=%s;"
@@ -325,7 +325,6 @@ inolog("hlen=%d", hlen);
            INI_DEBUG "=%d;"
            INI_COMMLOG "=%d;"
            INI_OPTIMIZER "=%d;"
-           INI_KSQO "=%d;"
            INI_USEDECLAREFETCH "=%d;"
            INI_TEXTASLONGVARCHAR "=%d;"
            INI_UNKNOWNSASLONGVARCHAR "=%d;"
@@ -367,7 +366,6 @@ inolog("hlen=%d", hlen);
            ,ci->drivers.debug
            ,ci->drivers.commlog
            ,ci->drivers.disable_optimizer
-           ,ci->drivers.ksqo
            ,ci->drivers.use_declarefetch
            ,ci->drivers.text_as_longvarchar
            ,ci->drivers.unknowns_as_longvarchar
@@ -407,12 +405,6 @@ inolog("hlen=%d", hlen);
            flag |= BIT_LFCONVERSION;
        if (ci->drivers.unique_index)
            flag |= BIT_UNIQUEINDEX;
-       if (PROTOCOL_74(ci))
-           flag |= (BIT_PROTOCOL_64 | BIT_PROTOCOL_63);
-       else if (PROTOCOL_64(ci))
-           flag |= BIT_PROTOCOL_64;
-       else if (PROTOCOL_63(ci))
-           flag |= BIT_PROTOCOL_63;
        switch (ci->drivers.unknown_sizes)
        {
            case UNKNOWNS_AS_DONTKNOW:
@@ -424,8 +416,6 @@ inolog("hlen=%d", hlen);
        }
        if (ci->drivers.disable_optimizer)
            flag |= BIT_OPTIMIZER;
-       if (ci->drivers.ksqo)
-           flag |= BIT_KSQO;
        if (ci->drivers.commlog)
            flag |= BIT_COMMLOG;
        if (ci->drivers.debug)
@@ -503,7 +493,7 @@ inolog("hlen=%d", hlen);
                makeXaOptConnectString(xaOptStr, ci, TRUE),
 #endif /* _HANDLE_ENLIST_IN_DTC_ */
                EFFECTIVE_BIT_COUNT, flag);
-       if (olen < nlen && (PROTOCOL_74(ci) || ci->rollback_on_error >= 0))
+       if (olen < nlen || ci->rollback_on_error >= 0)
        {
            hlen = strlen(connect_string);
            nlen = MAX_CONNECT_STRING - hlen;
@@ -513,12 +503,11 @@ inolog("hlen=%d", hlen);
             */
            if (ci->rollback_on_error >= 0)
                olen = snprintf(&connect_string[hlen], nlen, ";"
-               ABBR_PROTOCOL "=%s-%d",
-               ci->protocol, ci->rollback_on_error);
+               ABBR_PROTOCOL "=7.4-%d",
+                               ci->rollback_on_error);
            else
                olen = snprintf(&connect_string[hlen], nlen, ";"
-               ABBR_PROTOCOL "=%s",
-               ci->protocol);
+                               ABBR_PROTOCOL "=7.4");
        }
    }
    if (olen < nlen)
@@ -562,17 +551,6 @@ unfoldCXAttribute(ConnInfo *ci, const char *value)
    if (count < 4)
        return;
    ci->drivers.unique_index = (char)((flag & BIT_UNIQUEINDEX) != 0);
-   if ((flag & BIT_PROTOCOL_64) != 0)
-   {
-       if ((flag & BIT_PROTOCOL_63) != 0)
-           strcpy(ci->protocol, PG74);
-       else
-           strcpy(ci->protocol, PG64);
-   }
-   else if ((flag & BIT_PROTOCOL_63) != 0)
-       strcpy(ci->protocol, PG63);
-   else
-       strcpy(ci->protocol, PG62);
    if ((flag & BIT_UNKNOWN_DONTKNOW) != 0)
        ci->drivers.unknown_sizes = UNKNOWNS_AS_DONTKNOW;
    else if ((flag & BIT_UNKNOWN_ASMAX) != 0)
@@ -580,7 +558,6 @@ unfoldCXAttribute(ConnInfo *ci, const char *value)
    else
        ci->drivers.unknown_sizes = UNKNOWNS_AS_LONGEST;
    ci->drivers.disable_optimizer = (char)((flag & BIT_OPTIMIZER) != 0);
-   ci->drivers.ksqo = (char)((flag & BIT_KSQO) != 0);
    ci->drivers.commlog = (char)((flag & BIT_COMMLOG) != 0);
    ci->drivers.debug = (char)((flag & BIT_DEBUG) != 0);
    ci->drivers.parse = (char)((flag & BIT_PARSE) != 0);
@@ -636,20 +613,24 @@ copyAttributes(ConnInfo *ci, const char *attribute, const char *value)
    else if (stricmp(attribute, INI_PROTOCOL) == 0 || stricmp(attribute, ABBR_PROTOCOL) == 0)
    {
        char    *ptr;
-
+       /*
+        * The first part of the Protocol used to be "6.2", "6.3" or
+        * "7.4" to denote which protocol version to use. Nowadays we
+        * only support the 7.4 protocol, also known as the protocol
+        * version 3. So just ignore the first part of the string,
+        * parsing only the rollback_on_error value.
+        */
        ptr = strchr(value, '-');
        if (ptr)
        {
            if ('-' != *value)
            {
                *ptr = '\0';
-               strcpy(ci->protocol, value);
+               /* ignore first part */
            }
            ci->rollback_on_error = atoi(ptr + 1);
            mylog("rollback_on_error=%d\n", ci->rollback_on_error);
        }
-       else
-           strcpy(ci->protocol, value);
    }
 
    else if (stricmp(attribute, INI_SHOWOIDCOLUMN) == 0 || stricmp(attribute, ABBR_SHOWOIDCOLUMN) == 0)
@@ -766,7 +747,7 @@ copyAttributes(ConnInfo *ci, const char *attribute, const char *value)
    else
        found = FALSE;
 
-   mylog("%s: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s',conn_settings='%s',disallow_premature=%d)\n", func, ci->dsn, ci->server, ci->database, ci->username, NAME_IS_VALID(ci->password) ? "xxxxx" : "", ci->port, ci->onlyread, ci->protocol, ci->conn_settings, ci->disallow_premature);
+   mylog("%s: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',conn_settings='%s',disallow_premature=%d)\n", func, ci->dsn, ci->server, ci->database, ci->username, NAME_IS_VALID(ci->password) ? "xxxxx" : "", ci->port, ci->onlyread, ci->conn_settings, ci->disallow_premature);
 
    return found;
 }
@@ -787,8 +768,6 @@ copyCommonAttributes(ConnInfo *ci, const char *attribute, const char *value)
        ci->drivers.commlog = atoi(value);
    else if (stricmp(attribute, INI_OPTIMIZER) == 0 || stricmp(attribute, ABBR_OPTIMIZER) == 0)
        ci->drivers.disable_optimizer = atoi(value);
-   else if (stricmp(attribute, INI_KSQO) == 0 || stricmp(attribute, ABBR_KSQO) == 0)
-       ci->drivers.ksqo = atoi(value);
 
    /*
     * else if (stricmp(attribute, INI_UNIQUEINDEX) == 0 ||
@@ -820,7 +799,7 @@ copyCommonAttributes(ConnInfo *ci, const char *attribute, const char *value)
    else
        found = FALSE;
 
-   mylog("%s: A7=%d;A8=%d;A9=%d;B0=%d;B1=%d;B2=%d;B3=%d;B4=%d;B5=%d;B6=%d;B7=%d;B8=%d;B9=%d;C0=%d;C1=%d;C2=%s", func,
+   mylog("%s: A7=%d;A8=%d;A9=%d;B0=%d;B1=%d;B2=%d;B3=%d;B4=%d;B6=%d;B7=%d;B8=%d;B9=%d;C0=%d;C1=%d;C2=%s", func,
          ci->drivers.fetch_max,
          ci->drivers.socket_buffersize,
          ci->drivers.unknown_sizes,
@@ -829,7 +808,6 @@ copyCommonAttributes(ConnInfo *ci, const char *attribute, const char *value)
          ci->drivers.debug,
          ci->drivers.commlog,
          ci->drivers.disable_optimizer,
-         ci->drivers.ksqo,
          ci->drivers.use_declarefetch,
          ci->drivers.text_as_longvarchar,
          ci->drivers.unknowns_as_longvarchar,
@@ -853,9 +831,6 @@ getDSNdefaults(ConnInfo *ci)
    if (ci->onlyread[0] == '\0')
        sprintf(ci->onlyread, "%d", globals.onlyread);
 
-   if (ci->protocol[0] == '\0')
-       strcpy(ci->protocol, globals.protocol);
-
    if (ci->fake_oid_index[0] == '\0')
        sprintf(ci->fake_oid_index, "%d", DEFAULT_FAKEOIDINDEX);
 
@@ -996,11 +971,12 @@ getDSNinfo(ConnInfo *ci, char overwrite)
    if (ci->show_system_tables[0] == '\0' || overwrite)
        SQLGetPrivateProfileString(DSN, INI_SHOWSYSTEMTABLES, "", ci->show_system_tables, sizeof(ci->show_system_tables), ODBC_INI);
 
-   if (ci->protocol[0] == '\0' || overwrite)
+   if (ci->rollback_on_error == -1 || overwrite)
    {
+       char protocol[SMALL_REGISTRY_LEN];
        char    *ptr;
-       SQLGetPrivateProfileString(DSN, INI_PROTOCOL, "", ci->protocol, sizeof(ci->protocol), ODBC_INI);
-       if (ptr = strchr(ci->protocol, '-'), NULL != ptr)
+       SQLGetPrivateProfileString(DSN, INI_PROTOCOL, "", protocol, sizeof(protocol), ODBC_INI);
+       if (ptr = strchr(protocol, '-'), NULL != ptr)
        {
            *ptr = '\0';
            if (overwrite || ci->rollback_on_error < 0)
@@ -1143,9 +1119,8 @@ getDSNinfo(ConnInfo *ci, char overwrite)
         ci->database,
         ci->username,
         NAME_IS_VALID(ci->password) ? "xxxxx" : "");
-   qlog("          onlyread='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
+   qlog("          onlyread='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
         ci->onlyread,
-        ci->protocol,
         ci->show_oid_column,
         ci->fake_oid_index,
         ci->show_system_tables);
@@ -1200,10 +1175,6 @@ writeDriverCommoninfo(const char *fileName, const char *sectionName,
    if (!SQLWritePrivateProfileString(sectionName, INI_OPTIMIZER, tmp, fileName))
        errc--;
 
-   sprintf(tmp, "%d", comval->ksqo);
-   if (!SQLWritePrivateProfileString(sectionName, INI_KSQO, tmp, fileName))
-       errc--;
-
    sprintf(tmp, "%d", comval->unique_index);
    if (!SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp, fileName))
        errc--;
@@ -1332,9 +1303,9 @@ writeDSNinfo(const ConnInfo *ci)
                                 ODBC_INI);
 
    if (ci->rollback_on_error >= 0)
-       sprintf(temp, "%s-%d", ci->protocol, ci->rollback_on_error);
+       sprintf(temp, "7.4-%d", ci->rollback_on_error);
    else
-       strncpy_null(temp, ci->protocol, sizeof(temp));
+       strncpy_null(temp, "", sizeof(temp));
    SQLWritePrivateProfileString(DSN,
                                 INI_PROTOCOL,
                                 temp,
@@ -1489,14 +1460,6 @@ getCommonDefaults(const char *section, const char *filename, ConnInfo *ci)
    else if (inst_position)
        comval->disable_optimizer = DEFAULT_OPTIMIZER;
 
-   /* KSQO is stored in the driver section only */
-   SQLGetPrivateProfileString(section, INI_KSQO, "",
-                              temp, sizeof(temp), filename);
-   if (temp[0])
-       comval->ksqo = atoi(temp);
-   else if (inst_position)
-       comval->ksqo = DEFAULT_KSQO;
-
    /* Recognize Unique Index is stored in the driver section only */
    SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "",
                               temp, sizeof(temp), filename);
@@ -1505,7 +1468,6 @@ getCommonDefaults(const char *section, const char *filename, ConnInfo *ci)
    else if (inst_position)
        comval->unique_index = DEFAULT_UNIQUEINDEX;
 
-
    /* Unknown Sizes is stored in the driver section only */
    SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "",
                               temp, sizeof(temp), filename);
index 217e9a342dad19b68bd71e6f9d78fdc41325095e..83c2a49627715e25e07332648637f9c40cb24dc3 100644 (file)
@@ -78,9 +78,11 @@ extern "C" {
 #define INI_OPTIMIZER          "Optimizer" /* Use backend genetic
                             * optimizer */
 #define ABBR_OPTIMIZER         "B4"
-#define INI_KSQO           "Ksqo"      /* Keyset query
-                            * optimization */
-#define ABBR_KSQO          "B5"
+/* "Ksqo", abbreviated to B5 was used with pre-7.1 server versions for
+ * "keyset query optimization". No longer used.
+#define INI_KSQO                       "Ksqo"
+#define ABBR_KSQO                      "B5"
+*/
 #define INI_CONNSETTINGS        "ConnSettings" /* Anything to send to
                             * backend on successful
                             * connection */
@@ -181,7 +183,6 @@ extern "C" {
 #define BIT_UNKNOWN_DONTKNOW           (1L<<6)
 #define BIT_UNKNOWN_ASMAX          (1L<<7)
 #define BIT_OPTIMIZER              (1L<<8)
-#define BIT_KSQO               (1L<<9)
 #define BIT_COMMLOG                (1L<<10)
 #define BIT_DEBUG              (1L<<11)
 #define BIT_PARSE              (1L<<12)
@@ -222,7 +223,6 @@ extern "C" {
 #define DEFAULT_UNKNOWNSASLONGVARCHAR      0
 #define DEFAULT_BOOLSASCHAR            1
 #define DEFAULT_OPTIMIZER          0       /* enable */
-#define DEFAULT_KSQO               1       /* on */
 #define DEFAULT_UNIQUEINDEX            1       /* dont recognize */
 #define DEFAULT_COMMLOG                0       /* dont log */
 #define DEFAULT_DEBUG              0
index 62e4fe3d2d8344d8a93ce411fe5fc86877061cc4..9fcac3be65fa05c4745f3cfd84fbc469774a12d9 100644 (file)
@@ -162,7 +162,6 @@ driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable)
            {
                defval.commlog = DEFAULT_COMMLOG;
                defval.disable_optimizer = DEFAULT_OPTIMIZER;
-               defval.ksqo = DEFAULT_KSQO;
                defval.unique_index = DEFAULT_UNIQUEINDEX;
                defval.onlyread = DEFAULT_READONLY;
                defval.use_declarefetch = DEFAULT_USEDECLAREFETCH;
@@ -190,7 +189,6 @@ driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable)
    EnableWindow(GetDlgItem(hdlg, DRV_COMMLOG), FALSE);
 #endif /* Q_LOG */
    CheckDlgButton(hdlg, DRV_OPTIMIZER, comval->disable_optimizer);
-   CheckDlgButton(hdlg, DRV_KSQO, comval->ksqo);
    CheckDlgButton(hdlg, DRV_UNIQUEINDEX, comval->unique_index);
    /* EnableWindow(GetDlgItem(hdlg, DRV_UNIQUEINDEX), enable); */
    CheckDlgButton(hdlg, DRV_READONLY, comval->onlyread);
@@ -249,7 +247,6 @@ driver_options_update(HWND hdlg, ConnInfo *ci, const char *updateDriver)
        comval = &globals;
    comval->commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
    comval->disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
-   comval->ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
    comval->unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
    if (!ci)
    {
@@ -522,17 +519,6 @@ ds_options_update(HWND hdlg, ConnInfo *ci)
    /* Readonly */
    sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
 
-   /* Protocol */
-   if (IsDlgButtonChecked(hdlg, DS_PG62))
-       strcpy(ci->protocol, PG62);
-   else if (IsDlgButtonChecked(hdlg, DS_PG63))
-       strcpy(ci->protocol, PG63);
-   else if (IsDlgButtonChecked(hdlg, DS_PG64))
-       strcpy(ci->protocol, PG64);
-   else
-       /* latest */
-       strcpy(ci->protocol, PG74);
-
    /* Issue rollback command on error */
    if (IsDlgButtonChecked(hdlg, DS_NO_ROLLBACK))
        ci->rollback_on_error = 0;
@@ -650,19 +636,6 @@ ds_options2Proc(HWND hdlg,
 
            /* Protocol */
            enable = (ci->sslmode[0] == SSLLBYTE_DISABLE || ci->username[0] == '\0');
-           EnableWindow(GetDlgItem(hdlg, DS_PG62), enable);
-           EnableWindow(GetDlgItem(hdlg, DS_PG63), enable);
-           EnableWindow(GetDlgItem(hdlg, DS_PG64), enable);
-           EnableWindow(GetDlgItem(hdlg, DS_PG74), enable);
-           if (PROTOCOL_62(ci))
-               CheckDlgButton(hdlg, DS_PG62, 1);
-           else if (PROTOCOL_63(ci))
-               CheckDlgButton(hdlg, DS_PG63, 1);
-           else if (PROTOCOL_64(ci))
-               CheckDlgButton(hdlg, DS_PG64, 1);
-           else
-               /* latest */
-               CheckDlgButton(hdlg, DS_PG74, 1);
 
            /* How to issue Rollback */
            switch (ci->rollback_on_error)
index cad32ea18f105544d280c0ef6c06fd31a38f0775..65aa72972b92b63e7a2c48f8977c00cb986001f1 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -207,8 +207,7 @@ inquireHowToPrepare(const StatementClass *stmt)
 
    conn = SC_get_conn(stmt);
    ci = &(conn->connInfo);
-   if (!ci->use_server_side_prepare ||
-       PG_VERSION_LT(conn, 7.3))
+   if (!ci->use_server_side_prepare)
    {
        /* Do prepare operations by the driver itself */
        return PREPARE_BY_THE_DRIVER;
@@ -224,9 +223,15 @@ inquireHowToPrepare(const StatementClass *stmt)
        }
        if (stmt->multi_statement < 0)
            PGAPI_NumParams((StatementClass *) stmt, &num_params);
-       if (stmt->multi_statement > 0) /* would divide the query into multiple commands and apply V3 parse requests for each of them */
-           ret = PROTOCOL_74(ci) ? PARSE_REQ_FOR_INFO : PREPARE_BY_THE_DRIVER;
-       else if (PROTOCOL_74(ci))
+       if (stmt->multi_statement > 0)
+       {
+           /*
+            * divide the query into multiple commands and apply V3 parse
+            * requests for each of them
+            */
+           ret = PARSE_REQ_FOR_INFO;
+       }
+       else
        {
            if (SC_may_use_cursor(stmt))
            {
@@ -240,17 +245,6 @@ inquireHowToPrepare(const StatementClass *stmt)
            else
                ret = PARSE_TO_EXEC_ONCE;
        }
-       else
-       {
-           if (SC_may_use_cursor(stmt) &&
-               (SQL_CURSOR_FORWARD_ONLY != stmt->options.cursor_type ||
-               ci->drivers.use_declarefetch))
-               ret = PREPARE_BY_THE_DRIVER;
-           else if (SC_is_prepare_statement(stmt))
-               ret = USING_PREPARE_COMMAND;
-           else
-               ret = PREPARE_BY_THE_DRIVER;
-       }
    }
    if (SC_is_prepare_statement(stmt) && (PARSE_TO_EXEC_ONCE == ret))
        ret = NAMED_PARSE_REQUEST;
@@ -314,8 +308,6 @@ int HowToPrepareBeforeExec(StatementClass *stmt, BOOL checkOnly)
    {
        switch (how_to_prepare)
        {
-           case USING_PREPARE_COMMAND:
-               return checkOnly ? doNothing : usingCommand;
            case NAMED_PARSE_REQUEST:
                return shouldParse;
            case PARSE_TO_EXEC_ONCE:
@@ -335,9 +327,6 @@ int HowToPrepareBeforeExec(StatementClass *stmt, BOOL checkOnly)
                return doNothing;
        }
    }
-   if (PG_VERSION_LE(conn, 7.3) ||
-       !PROTOCOL_74(ci))
-       return nCallParse;
 
    if (num_params > 0)
    {
@@ -532,29 +521,6 @@ mylog("about to begin SC_execute\n");
            res = kres;
        }
    }
-#ifdef NOT_USED
-   else if (SC_is_concat_prepare_exec(stmt))
-   {
-       if (res && QR_command_maybe_successful(res))
-       {
-           QResultClass    *kres;
-
-           kres = res->next;
-inolog("res->next=%p\n", kres);
-           res->next = NULL;
-           SC_set_Result(stmt, kres);
-           res = kres;
-           SC_set_prepared(stmt, PREPARED_PERMANENTLY);
-       }
-       else
-       {
-           retval = SQL_ERROR;
-           if (stmt->execute_statement)
-               free(stmt->execute_statement);
-           stmt->execute_statement = NULL;
-       }
-   }
-#endif /* NOT_USED */
 #if (ODBCVER >= 0x0300)
    ipdopts = SC_get_IPDF(stmt);
    if (ipdopts->param_status_ptr)
diff --git a/info.c b/info.c
index ce00fc4a8915112915e2151dd2b4f00013301785..373952c9d0fb9ecd933556e424fff9265aea21a8 100644 (file)
--- a/info.c
+++ b/info.c
@@ -105,18 +105,15 @@ PGAPI_GetInfo(HDBC hdbc,
        case SQL_ALTER_TABLE:   /* ODBC 2.0 */
            len = 4;
            value = SQL_AT_ADD_COLUMN;
-           if (PG_VERSION_GE(conn, 7.3))
-               value |= SQL_AT_DROP_COLUMN;
+           value |= SQL_AT_DROP_COLUMN;
 #if (ODBCVER >= 0x0300)
-           value |= SQL_AT_ADD_COLUMN_SINGLE;
-           if (PG_VERSION_GE(conn, 7.1))
-               value |= SQL_AT_ADD_CONSTRAINT
+           value |= SQL_AT_ADD_COLUMN_SINGLE
+                   | SQL_AT_ADD_CONSTRAINT
                    | SQL_AT_ADD_TABLE_CONSTRAINT
                    | SQL_AT_CONSTRAINT_INITIALLY_DEFERRED
                    | SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE
-                   | SQL_AT_CONSTRAINT_DEFERRABLE;
-           if (PG_VERSION_GE(conn, 7.3))
-               value |= SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT
+                   | SQL_AT_CONSTRAINT_DEFERRABLE
+                   | SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT
                    | SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE
                    | SQL_AT_DROP_COLUMN_RESTRICT
                    | SQL_AT_DROP_COLUMN_CASCADE;
@@ -126,7 +123,7 @@ PGAPI_GetInfo(HDBC hdbc,
        case SQL_BOOKMARK_PERSISTENCE:  /* ODBC 2.0 */
            /* very simple bookmark support */
            len = 4;
-           value = ci->drivers.use_declarefetch && PG_VERSION_LT(conn, 7.4) ? 0 : (SQL_BP_SCROLL | SQL_BP_DELETE | SQL_BP_UPDATE | SQL_BP_TRANSACTION);
+           value = SQL_BP_SCROLL | SQL_BP_DELETE | SQL_BP_UPDATE | SQL_BP_TRANSACTION;
            break;
 
        case SQL_COLUMN_ALIAS:  /* ODBC 2.0 */
@@ -188,16 +185,15 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_CURSOR_COMMIT_BEHAVIOR:        /* ODBC 1.0 */
            len = 2;
-           value = SQL_CB_CLOSE;
-           if (!ci->drivers.use_declarefetch || PG_VERSION_GE(conn, 7.4))
-               value = SQL_CB_PRESERVE;
+           value = SQL_CB_PRESERVE;
            break;
 
        case SQL_CURSOR_ROLLBACK_BEHAVIOR:      /* ODBC 1.0 */
            len = 2;
-           value = SQL_CB_CLOSE;
            if (!ci->drivers.use_declarefetch)
                value = SQL_CB_PRESERVE;
+           else
+               value = SQL_CB_CLOSE;
            break;
 
        case SQL_DATA_SOURCE_NAME:      /* ODBC 1.0 */
@@ -248,10 +244,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */
            len = 4;
-           if (PG_VERSION_LT(conn, 6.5))
-               value = SQL_TXN_SERIALIZABLE;
-           else
-               value = SQL_TXN_READ_COMMITTED;
+           value = SQL_TXN_READ_COMMITTED;
            break;
 
        case SQL_DRIVER_NAME:   /* ODBC 1.0 */
@@ -270,7 +263,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
            break;
 
        case SQL_EXPRESSIONS_IN_ORDERBY:        /* ODBC 1.0 */
-           p = PG_VERSION_GE(conn, 6.5) ? "Y" : "N";
+           p = "Y";
            break;
 
        case SQL_FETCH_DIRECTION:       /* ODBC 1.0 */
@@ -311,7 +304,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_IDENTIFIER_QUOTE_CHAR: /* ODBC 1.0 */
            /* the character used to quote "identifiers" */
-           p = PG_VERSION_LE(conn, 6.2) ? " " : "\"";
+           p = "\"";
            break;
 
        case SQL_KEYWORDS:      /* ODBC 2.0 */
@@ -344,19 +337,9 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_MAX_COLUMN_NAME_LEN:   /* ODBC 1.0 */
            len = 2;
-           if (PG_VERSION_GT(conn, 7.4))
-               value = CC_get_max_idlen(conn);
-#ifdef MAX_COLUMN_LEN
-           else
-               value = MAX_COLUMN_LEN;
-#endif /* MAX_COLUMN_LEN */
+           value = CC_get_max_idlen(conn);
            if (0 == value)
-           {
-               if (PG_VERSION_GE(conn, 7.3))
-                   value = NAMEDATALEN_V73;
-               else
-                   value = NAMEDATALEN_V72;
-           }
+               value = NAMEDATALEN_V73;
            break;
 
        case SQL_MAX_COLUMNS_IN_GROUP_BY:       /* ODBC 2.0 */
@@ -400,14 +383,11 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
            if (PG_VERSION_GT(conn, 7.4))
                value = CC_get_max_idlen(conn);
 #ifdef MAX_SCHEMA_LEN
-           else if (conn->schema_support)
+           else
                value = MAX_SCHEMA_LEN;
 #endif /* MAX_SCHEMA_LEN */
            if (0 == value)
-           {
-               if (PG_VERSION_GE(conn, 7.3))
-                   value = NAMEDATALEN_V73;
-           }
+               value = NAMEDATALEN_V73;
            break;
 
        case SQL_MAX_PROCEDURE_NAME_LEN:        /* ODBC 1.0 */
@@ -422,16 +402,8 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_MAX_ROW_SIZE:  /* ODBC 2.0 */
            len = 4;
-           if (PG_VERSION_GE(conn, 7.1))
-           {
-               /* No limit with tuptoaster in 7.1+ */
-               value = 0;
-           }
-           else
-           {
-               /* Without the Toaster we're limited to the blocksize */
-               value = BLCKSZ;
-           }
+           /* No limit with tuptoaster in 7.1+ */
+           value = 0;
            break;
 
        case SQL_MAX_ROW_SIZE_INCLUDES_LONG:    /* ODBC 2.0 */
@@ -445,9 +417,8 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
            break;
 
        case SQL_MAX_STATEMENT_LEN:     /* ODBC 2.0 */
-           /* maybe this should be 0? */
            len = 4;
-           value = CC_get_max_query_len(conn);
+           value = 0;
            break;
 
        case SQL_MAX_TABLE_NAME_LEN:    /* ODBC 1.0 */
@@ -459,12 +430,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
                value = MAX_TABLE_LEN;
 #endif /* MAX_TABLE_LEN */
            if (0 == value)
-           {
-               if (PG_VERSION_GE(conn, 7.3))
-                   value = NAMEDATALEN_V73;
-               else
-                   value = NAMEDATALEN_V72;
-           }
+               value = NAMEDATALEN_V73;
            break;
 
        case SQL_MAX_TABLES_IN_SELECT:  /* ODBC 2.0 */
@@ -503,10 +469,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
        case SQL_NULL_COLLATION:        /* ODBC 2.0 */
            /* where are nulls sorted? */
            len = 2;
-           if (PG_VERSION_GE(conn, 7.2))
-               value = SQL_NC_HIGH;
-           else
-               value = SQL_NC_END;
+           value = SQL_NC_HIGH;
            break;
 
        case SQL_NUMERIC_FUNCTIONS:     /* ODBC 1.0 */
@@ -535,51 +498,33 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_OJ_CAPABILITIES:       /* ODBC 2.01 */
            len = 4;
-           if (PG_VERSION_GE(conn, 7.1))
-           {
-               /* OJs in 7.1+ */
-               value = (SQL_OJ_LEFT |
-                        SQL_OJ_RIGHT |
-                        SQL_OJ_FULL |
-                        SQL_OJ_NESTED |
-                        SQL_OJ_NOT_ORDERED |
-                        SQL_OJ_INNER |
-                        SQL_OJ_ALL_COMPARISON_OPS);
-           }
-           else
-               /* OJs not in <7.1 */
-               value = 0;
+           value = (SQL_OJ_LEFT |
+                    SQL_OJ_RIGHT |
+                    SQL_OJ_FULL |
+                    SQL_OJ_NESTED |
+                    SQL_OJ_NOT_ORDERED |
+                    SQL_OJ_INNER |
+                    SQL_OJ_ALL_COMPARISON_OPS);
            break;
 
        case SQL_ORDER_BY_COLUMNS_IN_SELECT:    /* ODBC 2.0 */
-           p = (PG_VERSION_LE(conn, 6.3)) ? "Y" : "N";
+           p = "Y";
            break;
 
        case SQL_OUTER_JOINS:   /* ODBC 1.0 */
-           if (PG_VERSION_GE(conn, 7.1))
-               /* OJs in 7.1+ */
-               p = "Y";
-           else
-               /* OJs not in <7.1 */
-               p = "N";
+           p = "Y";
            break;
 
        case SQL_OWNER_TERM:    /* ODBC 1.0 */
-           if (conn->schema_support)
-               p = "schema";
-           else
-               p = "owner";
+           p = "schema";
            break;
 
        case SQL_OWNER_USAGE:   /* ODBC 2.0 */
            len = 4;
-           value = 0;
-           if (conn->schema_support)
-               value = SQL_OU_DML_STATEMENTS
+           value = SQL_OU_DML_STATEMENTS
                    | SQL_OU_TABLE_DEFINITION
                    | SQL_OU_INDEX_DEFINITION
-                   | SQL_OU_PRIVILEGE_DEFINITION
-                   ;
+                   | SQL_OU_PRIVILEGE_DEFINITION;
            break;
 
        case SQL_POS_OPERATIONS:        /* ODBC 2.0 */
@@ -670,10 +615,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
            break;
 
        case SQL_SEARCH_PATTERN_ESCAPE: /* ODBC 1.0 */
-           if (PG_VERSION_GE(conn, 6.5))
-               p = "\\";
-           else
-               p = NULL_STRING;
+           p = "\\";
            break;
 
        case SQL_SERVER_NAME:   /* ODBC 1.0 */
@@ -748,12 +690,7 @@ mylog("CONVERT_FUNCTIONS=" FORMAT_ULEN "\n", value);
 
        case SQL_TXN_ISOLATION_OPTION:  /* ODBC 1.0 */
            len = 4;
-           if (PG_VERSION_LT(conn, 6.5))
-               value = SQL_TXN_SERIALIZABLE;
-           else if (PG_VERSION_GE(conn, 7.1))
-               value = SQL_TXN_READ_COMMITTED | SQL_TXN_SERIALIZABLE;
-           else
-               value = SQL_TXN_READ_COMMITTED;
+           value = SQL_TXN_READ_COMMITTED | SQL_TXN_SERIALIZABLE;
            break;
 
        case SQL_UNION: /* ODBC 2.0 */
@@ -908,7 +845,7 @@ inolog("%d sqltype=%d -> pgtype=%d\n", ci->bytea_as_longvarbinary, sqlType, pgTy
            if (SQL_INTEGER == sqlType)
            {
 mylog("sqlType=%d ms_jet=%d\n", sqlType, conn->ms_jet);
-               if (conn->ms_jet && PG_VERSION_GE(conn, 6.4))
+               if (conn->ms_jet)
                {
                    aunq_match = 1;
                    pgtcount = 2;
@@ -1069,10 +1006,7 @@ PGAPI_GetFunctions(HDBC hdbc,
 
            /* ODBC level 2 functions */
            pfExists[SQL_API_SQLBROWSECONNECT] = FALSE;
-           if (PG_VERSION_GE(conn, 7.4))
-               pfExists[SQL_API_SQLCOLUMNPRIVILEGES] = FALSE;
-           else
-               pfExists[SQL_API_SQLCOLUMNPRIVILEGES] = FALSE;
+           pfExists[SQL_API_SQLCOLUMNPRIVILEGES] = FALSE;
            pfExists[SQL_API_SQLDATASOURCES] = FALSE;   /* only implemented by
                                                         * DM */
            if (SUPPORT_DESCRIBE_PARAM(ci))
@@ -1089,14 +1023,8 @@ PGAPI_GetFunctions(HDBC hdbc,
            pfExists[SQL_API_SQLNUMPARAMS] = TRUE;
            pfExists[SQL_API_SQLPARAMOPTIONS] = TRUE;
            pfExists[SQL_API_SQLPRIMARYKEYS] = TRUE;
-           if (PG_VERSION_LT(conn, 6.5))
-               pfExists[SQL_API_SQLPROCEDURECOLUMNS] = FALSE;
-           else
-               pfExists[SQL_API_SQLPROCEDURECOLUMNS] = TRUE;
-           if (PG_VERSION_LT(conn, 6.5))
-               pfExists[SQL_API_SQLPROCEDURES] = FALSE;
-           else
-               pfExists[SQL_API_SQLPROCEDURES] = TRUE;
+           pfExists[SQL_API_SQLPROCEDURECOLUMNS] = TRUE;
+           pfExists[SQL_API_SQLPROCEDURES] = TRUE;
            pfExists[SQL_API_SQLSETPOS] = TRUE;
            pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE;       /* odbc 1.0 */
            pfExists[SQL_API_SQLTABLEPRIVILEGES] = TRUE;
@@ -1297,16 +1225,10 @@ PGAPI_GetFunctions(HDBC hdbc,
                    *pfExists = TRUE;
                    break;
                case SQL_API_SQLPROCEDURECOLUMNS:
-                   if (PG_VERSION_LT(conn, 6.5))
-                       *pfExists = FALSE;
-                   else
-                       *pfExists = TRUE;
+                   *pfExists = TRUE;
                    break;
                case SQL_API_SQLPROCEDURES:
-                   if (PG_VERSION_LT(conn, 6.5))
-                       *pfExists = FALSE;
-                   else
-                       *pfExists = TRUE;
+                   *pfExists = TRUE;
                    break;
                case SQL_API_SQLSETPOS:
                    *pfExists = TRUE;
@@ -1631,46 +1553,21 @@ retry_public_schema:
        strncpy_null(tables_query, "select NULL, NULL, relkind from (select 'r' as relkind union select 'v') as a", sizeof(tables_query));
    else if (list_schemas)
    {
-       if (conn->schema_support)
-           strncpy_null(tables_query, "select NULL, nspname, NULL"
+       strncpy_null(tables_query, "select NULL, nspname, NULL"
            " from pg_catalog.pg_namespace n where true", sizeof(tables_query));
-       else
-           strncpy_null(tables_query, "select NULL, NULL as nspname, NULL", sizeof(tables_query));
    }
-   else if (conn->schema_support)
+   else
    {
        /* view is represented by its relkind since 7.1 */
        strcpy(tables_query, "select relname, nspname, relkind"
            " from pg_catalog.pg_class c, pg_catalog.pg_namespace n");
        strcat(tables_query, " where relkind in ('r', 'v')");
    }
-   else if (PG_VERSION_GE(conn, 7.1))
-   {
-       /* view is represented by its relkind since 7.1 */
-       strcpy(tables_query, "select relname, usename, relkind"
-       " from pg_class c, pg_user u");
-       strcat(tables_query, " where relkind in ('r', 'v')");
-   }
-   else
-   {
-       strcpy(tables_query, "select relname, usename, relhasrules from pg_class c, pg_user u");
-       strcat(tables_query, " where relkind = 'r'");
-   }
 
    op_string = gen_opestr(like_or_eq, conn);
    if (!list_some)
    {
-       if (conn->schema_support)
-       {
-           schema_strcat1(tables_query, " and nspname %s'%.*s'", op_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
-           /* strcat(tables_query, " and pg_catalog.pg_table_is_visible(c.oid)"); */
-       }
-       else
-       {
-           if (IS_VALID_NAME(escSchemaName))
-               snprintf_add(tables_query, sizeof(tables_query),
-                        " and usename %s'%s'", op_string, escSchemaName);
-       }
+       schema_strcat1(tables_query, " and nspname %s'%.*s'", op_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
        if (IS_VALID_NAME(escTableName))
            snprintf_add(tables_query, sizeof(tables_query),
                     " and relname %s'%s'", op_string, escTableName);
@@ -1750,22 +1647,7 @@ retry_public_schema:
     * tables, then dont filter either.
     */
    if ((list_schemas || !list_some) && !atoi(ci->show_system_tables) && !show_system_tables)
-   {
-       if (conn->schema_support)
-           strcat(tables_query, " and nspname not in ('pg_catalog', 'information_schema', 'pg_toast', 'pg_temp_1')");
-       else if (!list_schemas)
-       {
-           strcat(tables_query, " and relname !~ '^" POSTGRES_SYS_PREFIX);
-
-           /* Also filter out user-defined system table types */
-           for (i = 0; i < nprefixes; i++)
-           {
-               strcat(tables_query, "|^");
-               strcat(tables_query, prefix[i]);
-           }
-           strcat(tables_query, "'");
-       }
-   }
+       strcat(tables_query, " and nspname not in ('pg_catalog', 'information_schema', 'pg_toast', 'pg_temp_1')");
 
    if (!list_some)
    {
@@ -1776,16 +1658,8 @@ retry_public_schema:
        strcat(tables_query, " order by nspname");
    else if (list_some)
        ;
-   else if (conn->schema_support)
-       strcat(tables_query, " and n.oid = relnamespace order by nspname, relname");
    else
-   {
-       /* match users */
-       if (PG_VERSION_LT(conn, 7.1))
-           /* filter out large objects in older versions */
-           strcat(tables_query, " and relname !~ '^xinv[0-9]+'");
-       strcat(tables_query, " and usesysid = relowner order by relname");
-   }
+       strcat(tables_query, " and n.oid = relnamespace order by nspname, relname");
 
    result = PGAPI_ExecDirect(htbl_stmt, (SQLCHAR *) tables_query, SQL_NTS, 0);
    if (!SQL_SUCCEEDED(result))
@@ -1795,8 +1669,7 @@ retry_public_schema:
    }
 
    /* If not found */
-   if (conn->schema_support &&
-       (res = SC_get_Result(tbl_stmt)) &&
+   if ((res = SC_get_Result(tbl_stmt)) &&
        0 == QR_get_num_total_tuples(res))
    {
        if (allow_public_schema(conn, szSchemaName, cbSchemaName))
@@ -1879,17 +1752,11 @@ retry_public_schema:
        systable = FALSE;
        if (!atoi(ci->show_system_tables))
        {
-           if (conn->schema_support)
-           {
-               if (stricmp(table_owner, "pg_catalog") == 0 ||
-                   stricmp(table_owner, "pg_toast") == 0 ||
-                   strnicmp(table_owner, "pg_temp_", 8) == 0 ||
-                   stricmp(table_owner, "information_schema") == 0)
-                   systable = TRUE;
-           }
-           else if (strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)
+           if (stricmp(table_owner, "pg_catalog") == 0 ||
+               stricmp(table_owner, "pg_toast") == 0 ||
+               strnicmp(table_owner, "pg_temp_", 8) == 0 ||
+               stricmp(table_owner, "information_schema") == 0)
                systable = TRUE;
-
            else
            {
                /* Check extra system table prefixes */
@@ -1906,16 +1773,11 @@ retry_public_schema:
        }
 
        /* Determine if the table name is a view */
-       if (PG_VERSION_GE(conn, 7.1))
-           /* view is represented by its relkind since 7.1 */
-           view = (relkind_or_hasrules[0] == 'v');
-       else
-           view = (relkind_or_hasrules[0] == '1');
+       view = (relkind_or_hasrules[0] == 'v');
 
        /* It must be a regular table */
        regular_table = (!systable && !view);
 
-
        /* Include the row in the result set if meets all criteria */
 
        /*
@@ -1944,7 +1806,7 @@ retry_public_schema:
 
            mylog("%s: table_name = '%s'\n", func, table_name);
 
-           if (list_schemas || (conn->schema_support && !list_some))
+           if (list_schemas || !list_some)
                set_tuplefield_string(&tuple[TABLES_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
            else
                set_tuplefield_null(&tuple[TABLES_SCHEMA_NAME]);
@@ -2103,67 +1965,38 @@ retry_public_schema:
     * have the atttypmod field)
     */
    op_string = gen_opestr(like_or_eq, conn);
-   if (conn->schema_support)
-   {
-       snprintf(columns_query, sizeof(columns_query),
-           "select n.nspname, c.relname, a.attname, a.atttypid"
-           ", t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull"
-           ", c.relhasrules, c.relkind, c.oid, %s, %s, %s"
-           " from (((pg_catalog.pg_class c"
-           " inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace",
-           PG_VERSION_GE(conn, 7.4) ?
-           "pg_get_expr(d.adbin, d.adrelid)" : "d.adsrc",
-           PG_VERSION_GE(conn, 7.4) ?
-           "case t.typtype when 'd' then t.typbasetype else 0 end, t.typtypmod"
-                   : "0, -1",
-           PG_VERSION_GE(conn, 7.2) ? "c.relhasoids" : "1"
-                   );
-       if (search_by_ids)
-           snprintf_add(columns_query, sizeof(columns_query), " and c.oid = %u", reloid);
-       else
-       {
-           if (escTableName)
-               snprintf_add(columns_query, sizeof(columns_query), " and c.relname %s'%s'", op_string, escTableName);
-           schema_strcat1(columns_query, " and n.nspname %s'%.*s'", op_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
-       }
-       strcat(columns_query, ") inner join pg_catalog.pg_attribute a"
-           " on (not a.attisdropped)");
-       if (0 == attnum && (NULL == escColumnName || like_or_eq != eqop))
-           strcat(columns_query, " and a.attnum > 0");
-       if (search_by_ids)
-       {
-           if (attnum != 0)
-               snprintf_add(columns_query, sizeof(columns_query), " and a.attnum = %d", attnum);
-       }
-       else if (escColumnName)
-           snprintf_add(columns_query, sizeof(columns_query), " and a.attname %s'%s'", op_string, escColumnName);
-       strcat(columns_query,
-           " and a.attrelid = c.oid) inner join pg_catalog.pg_type t"
-           " on t.oid = a.atttypid) left outer join pg_attrdef d"
-           " on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum");
-       strcat(columns_query, " order by n.nspname, c.relname, attnum");
-   }
+   snprintf(columns_query, sizeof(columns_query),
+       "select n.nspname, c.relname, a.attname, a.atttypid, "
+       "t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull, "
+       "c.relhasrules, c.relkind, c.oid, pg_get_expr(d.adbin, d.adrelid), "
+        "case t.typtype when 'd' then t.typbasetype else 0 end, t.typtypmod, "
+        "c.relhasoids "
+       "from (((pg_catalog.pg_class c "
+       "inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace");
+   if (search_by_ids)
+       snprintf_add(columns_query, sizeof(columns_query), " and c.oid = %u", reloid);
    else
    {
-       snprintf(columns_query, sizeof(columns_query),
-           "select u.usename, c.relname, a.attname, a.atttypid"
-           ", t.typname, a.attnum, a.attlen, %s, a.attnotnull"
-           ", c.relhasrules, c.relkind, c.oid, NULL, 0, -1 from"
-           "  pg_user u, pg_class c, pg_attribute a, pg_type t where"
-           "  u.usesysid = c.relowner and c.oid= a.attrelid"
-           "  and a.atttypid = t.oid and (a.attnum > 0)",
-           PG_VERSION_LE(conn, 6.2) ? "a.attlen" : "a.atttypmod");
        if (escTableName)
-           snprintf_add(columns_query, sizeof(columns_query),
-                        " and c.relname %s'%s'", op_string, escTableName);
-       if (IS_VALID_NAME(escSchemaName))
-           snprintf_add(columns_query, sizeof(columns_query),
-                    " and u.usename %s'%s'", op_string, escSchemaName);
-       if (escColumnName)
-           snprintf_add(columns_query, sizeof(columns_query),
-                        " and a.attname %s'%s'", op_string, escColumnName);
-       strcat(columns_query, " order by c.relname, attnum");
+           snprintf_add(columns_query, sizeof(columns_query), " and c.relname %s'%s'", op_string, escTableName);
+       schema_strcat1(columns_query, " and n.nspname %s'%.*s'", op_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
    }
+   strcat(columns_query, ") inner join pg_catalog.pg_attribute a"
+       " on (not a.attisdropped)");
+   if (0 == attnum && (NULL == escColumnName || like_or_eq != eqop))
+       strcat(columns_query, " and a.attnum > 0");
+   if (search_by_ids)
+   {
+       if (attnum != 0)
+           snprintf_add(columns_query, sizeof(columns_query), " and a.attnum = %d", attnum);
+   }
+   else if (escColumnName)
+       snprintf_add(columns_query, sizeof(columns_query), " and a.attname %s'%s'", op_string, escColumnName);
+   strcat(columns_query,
+       " and a.attrelid = c.oid) inner join pg_catalog.pg_type t"
+       " on t.oid = a.atttypid) left outer join pg_attrdef d"
+       " on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum");
+   strcat(columns_query, " order by n.nspname, c.relname, attnum");
 
    result = PGAPI_AllocStmt(conn, &hcol_stmt, 0);
    if (!SQL_SUCCEEDED(result))
@@ -2185,8 +2018,7 @@ retry_public_schema:
    }
 
    /* If not found */
-   if (conn->schema_support &&
-       (flag & PODBC_SEARCH_PUBLIC_SCHEMA) != 0 &&
+   if ((flag & PODBC_SEARCH_PUBLIC_SCHEMA) != 0 &&
        (res = SC_get_Result(col_stmt)) &&
        0 == QR_get_num_total_tuples(res))
    {
@@ -2384,11 +2216,8 @@ retry_public_schema:
     * being called by SQLStatistics . Always show OID if it's a system
     * table
     */
+   relisaview = (relkind[0] == 'v');
 
-   if (PG_VERSION_GE(conn, 7.1))
-       relisaview = (relkind[0] == 'v');
-   else
-       relisaview = (relhasrules[0] == '1');
    if (result != SQL_ERROR && !stmt->internal)
    {
        if (!relisaview &&
@@ -2403,10 +2232,7 @@ retry_public_schema:
            tuple = QR_AddNew(res);
            set_tuplefield_string(&tuple[COLUMNS_CATALOG_NAME], CurrCat(conn));
            /* see note in SQLTables() */
-           if (conn->schema_support)
-               set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
-           else
-               set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], NULL_STRING);
+           set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
            set_tuplefield_string(&tuple[COLUMNS_TABLE_NAME], table_name);
            set_tuplefield_string(&tuple[COLUMNS_COLUMN_NAME], OID_NAME);
            sqltype = pgtype_to_concise_type(stmt, the_type, PG_STATIC);
@@ -2466,10 +2292,7 @@ mylog(" and the data=%s\n", attdef);
        sqltype = SQL_TYPE_NULL;    /* unspecified */
        set_tuplefield_string(&tuple[COLUMNS_CATALOG_NAME], CurrCat(conn));
        /* see note in SQLTables() */
-       if (conn->schema_support)
-           set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
-       else
-           set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], NULL_STRING);
+       set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
        set_tuplefield_string(&tuple[COLUMNS_TABLE_NAME], table_name);
        set_tuplefield_string(&tuple[COLUMNS_COLUMN_NAME], field_name);
        auto_unique = SQL_FALSE;
@@ -2552,12 +2375,8 @@ mylog(" and the data=%s\n", attdef);
        else if ((field_type == PG_TYPE_DATETIME) ||
            (field_type == PG_TYPE_TIMESTAMP_NO_TMZONE))
        {
-           if (PG_VERSION_GE(conn, 7.2))
-           {
-               useStaticScale = FALSE;
-
-               set_nullfield_int2(&tuple[COLUMNS_SCALE], (Int2) mod_length);
-           }
+           useStaticScale = FALSE;
+           set_nullfield_int2(&tuple[COLUMNS_SCALE], (Int2) mod_length);
        }
 
        if ((field_type == PG_TYPE_VARCHAR) ||
@@ -2690,10 +2509,7 @@ mylog(" and the data=%s\n", attdef);
        tuple = QR_AddNew(res);
 
        set_tuplefield_string(&tuple[COLUMNS_CATALOG_NAME], CurrCat(conn));
-       if (conn->schema_support)
-           set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
-       else
-           set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], NULL_STRING);
+       set_tuplefield_string(&tuple[COLUMNS_SCHEMA_NAME], GET_SCHEMA_NAME(table_owner));
        set_tuplefield_string(&tuple[COLUMNS_TABLE_NAME], table_name);
        set_tuplefield_string(&tuple[COLUMNS_COLUMN_NAME], "xmin");
        sqltype = pgtype_to_concise_type(stmt, the_type, PG_STATIC);
@@ -2810,32 +2626,17 @@ retry_public_schema:
    /*
     * Create the query to find out if this is a view or not...
     */
-   strcpy(columns_query, "select c.relhasrules, c.relkind");
-   if (PG_VERSION_GE(conn, 7.2))
-       strcat(columns_query, ", c.relhasoids");
-   if (conn->schema_support)
-       strcat(columns_query, " from pg_catalog.pg_namespace u,"
-       " pg_catalog.pg_class c where "
-           "u.oid = c.relnamespace");
-   else
-       strcat(columns_query, " from pg_user u, pg_class c where "
-           "u.usesysid = c.relowner");
+   strcpy(columns_query, "select c.relhasrules, c.relkind, c.relhasoids");
+   strcat(columns_query, " from pg_catalog.pg_namespace u,"
+                   " pg_catalog.pg_class c where "
+                   "u.oid = c.relnamespace");
 
    /* TableName cannot contain a string search pattern */
-   /* my_strcat(columns_query, " and c.relname = '%.*s'", szTableName, cbTableName); */
    if (escTableName)
        snprintf_add(columns_query, sizeof(columns_query),
                     " and c.relname %s'%s'", eq_string, escTableName);
    /* SchemaName cannot contain a string search pattern */
-   if (conn->schema_support)
-       schema_strcat1(columns_query, " and u.nspname %s'%.*s'", eq_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
-   else
-   {
-       if (IS_VALID_NAME(escSchemaName))
-           snprintf_add(columns_query, sizeof(columns_query),
-                    " and u.usename %s'%s'", eq_string, escSchemaName);
-   }
-
+   schema_strcat1(columns_query, " and u.nspname %s'%.*s'", eq_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
 
    result = PGAPI_AllocStmt(conn, &hcol_stmt, 0);
    if (!SQL_SUCCEEDED(result))
@@ -2857,8 +2658,7 @@ retry_public_schema:
    }
 
    /* If not found */
-   if (conn->schema_support &&
-       (res = SC_get_Result(col_stmt)) &&
+   if ((res = SC_get_Result(col_stmt)) &&
        0 == QR_get_num_total_tuples(res))
    {
        if (allow_public_schema(conn, szSchemaName, cbSchemaName))
@@ -2889,23 +2689,17 @@ retry_public_schema:
        goto cleanup;
    }
    relhasoids[0] = '1';
-   if (PG_VERSION_GE(conn, 7.2))
+   result = PGAPI_BindCol(hcol_stmt, 3, internal_asis_type,
+               relhasoids, sizeof(relhasoids), NULL);
+   if (!SQL_SUCCEEDED(result))
    {
-       result = PGAPI_BindCol(hcol_stmt, 3, internal_asis_type,
-                   relhasoids, sizeof(relhasoids), NULL);
-       if (!SQL_SUCCEEDED(result))
-       {
-           SC_error_copy(stmt, col_stmt, TRUE);
-           result = SQL_ERROR;
-           goto cleanup;
-       }
+       SC_error_copy(stmt, col_stmt, TRUE);
+       result = SQL_ERROR;
+       goto cleanup;
    }
 
    result = PGAPI_Fetch(hcol_stmt);
-   if (PG_VERSION_GE(conn, 7.1))
-       relisaview = (relkind[0] == 'v');
-   else
-       relisaview = (relhasrules[0] == '1');
+   relisaview = (relkind[0] == 'v');
    PGAPI_FreeStmt(hcol_stmt, SQL_DROP);
    hcol_stmt = NULL;
 
@@ -3110,8 +2904,7 @@ PGAPI_Statistics(HSTMT hstmt,
    cbSchemaName = cbTableOwner;
 
    table_schemaname[0] = '\0';
-   if (conn->schema_support)
-       schema_strcat(table_schemaname, "%.*s", szSchemaName, cbSchemaName, szTableName, cbTableName, conn);
+   schema_strcat(table_schemaname, "%.*s", szSchemaName, cbSchemaName, szTableName, cbTableName, conn);
 
    /*
     * we need to get a list of the field names first, so we can return
@@ -3217,41 +3010,23 @@ PGAPI_Statistics(HSTMT hstmt,
    /* TableName cannot contain a string search pattern */
    escTableName = simpleCatalogEscape((SQLCHAR *) table_name, SQL_NTS, NULL, conn);
    eq_string = gen_opestr(eqop, conn);
-   if (conn->schema_support)
-   {
-       escSchemaName = simpleCatalogEscape((SQLCHAR *) table_schemaname, SQL_NTS, NULL, conn);
-       snprintf(index_query, sizeof(index_query), "select c.relname, i.indkey, i.indisunique"
-           ", i.indisclustered, a.amname, c.relhasrules, n.nspname"
-           ", c.oid, %s, %s"
-           " from pg_catalog.pg_index i, pg_catalog.pg_class c,"
-           " pg_catalog.pg_class d, pg_catalog.pg_am a,"
-           " pg_catalog.pg_namespace n"
-           " where d.relname %s'%s'"
-           " and n.nspname %s'%s'"
-           " and n.oid = d.relnamespace"
-           " and d.oid = i.indrelid"
-           " and i.indexrelid = c.oid"
-           " and c.relam = a.oid order by"
-           , PG_VERSION_GE(conn, 7.2) ? "d.relhasoids" : "1"
-           , PG_VERSION_GE(conn, 8.3) ? "i.indoption" : "0"
-           , eq_string, escTableName, eq_string, escSchemaName);
-   }
-   else
-       snprintf(index_query, sizeof(index_query), "select c.relname, i.indkey, i.indisunique"
-           ", i.indisclustered, a.amname, c.relhasrules, c.oid, %s, 0"
-           " from pg_index i, pg_class c, pg_class d, pg_am a"
-           " where d.relname %s'%s'"
-           " and d.oid = i.indrelid"
-           " and i.indexrelid = c.oid"
-           " and c.relam = a.oid order by"
-           , PG_VERSION_GE(conn, 7.2) ? "d.relhasoids" : "1"
-           , eq_string, escTableName);
-   if (PG_VERSION_GT(SC_get_conn(stmt), 6.4))
-       strcat(index_query, " i.indisprimary desc,");
-   if (conn->schema_support)
-       strcat(index_query, " i.indisunique, n.nspname, c.relname");
-   else
-       strcat(index_query, " i.indisunique, c.relname");
+   escSchemaName = simpleCatalogEscape((SQLCHAR *) table_schemaname, SQL_NTS, NULL, conn);
+   snprintf(index_query, sizeof(index_query), "select c.relname, i.indkey, i.indisunique"
+       ", i.indisclustered, a.amname, c.relhasrules, n.nspname"
+       ", c.oid, d.relhasoids, %s"
+       " from pg_catalog.pg_index i, pg_catalog.pg_class c,"
+       " pg_catalog.pg_class d, pg_catalog.pg_am a,"
+       " pg_catalog.pg_namespace n"
+       " where d.relname %s'%s'"
+       " and n.nspname %s'%s'"
+       " and n.oid = d.relnamespace"
+       " and d.oid = i.indrelid"
+       " and i.indexrelid = c.oid"
+       " and c.relam = a.oid order by"
+       , PG_VERSION_GE(conn, 8.3) ? "i.indoption" : "0"
+       , eq_string, escTableName, eq_string, escSchemaName);
+   strcat(index_query, " i.indisprimary desc,");
+   strcat(index_query, " i.indisunique, n.nspname, c.relname");
 
    result = PGAPI_ExecDirect(hindx_stmt, (SQLCHAR *) index_query, SQL_NTS, 0);
    if (!SQL_SUCCEEDED(result))
@@ -3561,8 +3336,6 @@ PGAPI_ColumnPrivileges(HSTMT hstmt,
 
    if (result = SC_initialize_and_recycle(stmt), SQL_SUCCESS != result)
        return result;
-   if (PG_VERSION_LT(conn, 7.4))
-       SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, "Function not implementedyet", func);
    escSchemaName = simpleCatalogEscape(szTableOwner, cbTableOwner, NULL, conn);
    escTableName = simpleCatalogEscape(szTableName, cbTableName, NULL, conn);
    search_pattern = (0 == (flag & PODBC_NOT_SEARCH_PATTERN));
@@ -3752,8 +3525,7 @@ retry_public_schema:
        if (escSchemaName)
            free(escSchemaName);
        escSchemaName = simpleCatalogEscape(szSchemaName, cbSchemaName, NULL, conn);
-       if (conn->schema_support)
-           schema_strcat(pkscm, "%.*s", (SQLCHAR *) escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
+       schema_strcat(pkscm, "%.*s", (SQLCHAR *) escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
    }
 
    result = PGAPI_BindCol(htbl_stmt, 1, internal_asis_type,
@@ -3789,10 +3561,7 @@ retry_public_schema:
        goto cleanup;
    }
 
-   if (PG_VERSION_LE(conn, 6.4))
-       qstart = 2;
-   else
-       qstart = 1;
+   qstart = 1;
    if (0 == reloid)
        qend = 2;
    else
@@ -3811,98 +3580,58 @@ retry_public_schema:
                 * possible index columns. Courtesy of Tom Lane - thomas
                 * 2000-03-21
                 */
-               if (conn->schema_support)
-               {
-                   strncpy_null(tables_query,
-                       "select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname"
-                       " from pg_catalog.pg_attribute ta,"
-                       " pg_catalog.pg_attribute ia, pg_catalog.pg_class tc,"
-                       " pg_catalog.pg_index i, pg_catalog.pg_namespace n"
-                       ", pg_catalog.pg_class ic"
-                       , sizeof(tables_query));
-                   qsize = strlen(tables_query);
-                   tsize = sizeof(tables_query) - qsize;
-                   tbqry = tables_query + qsize;
-                   if (0 == reloid)
-                       snprintf(tbqry, tsize,
-                       " where tc.relname %s'%s'"
-                       " AND n.nspname %s'%s'"
-                       , eq_string, escTableName, eq_string, pkscm);
-                   else
-                       snprintf(tbqry, tsize,
-                       " where tc.oid = " FORMAT_UINT4
-                       , reloid);
-
-                   strlcat(tables_query,
-                       " AND tc.oid = i.indrelid"
-                       " AND n.oid = tc.relnamespace"
-                       " AND i.indisprimary = 't'"
-                       " AND ia.attrelid = i.indexrelid"
-                       " AND ta.attrelid = i.indrelid"
-                       " AND ta.attnum = i.indkey[ia.attnum-1]"
-                       " AND (NOT ta.attisdropped)"
-                       " AND (NOT ia.attisdropped)"
-                       " AND ic.oid = i.indexrelid"
-                       " order by ia.attnum"
-                       , sizeof(tables_query));
-               }
+               strncpy_null(tables_query,
+                   "select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname"
+                   " from pg_catalog.pg_attribute ta,"
+                   " pg_catalog.pg_attribute ia, pg_catalog.pg_class tc,"
+                   " pg_catalog.pg_index i, pg_catalog.pg_namespace n"
+                   ", pg_catalog.pg_class ic"
+                   , sizeof(tables_query));
+               qsize = strlen(tables_query);
+               tsize = sizeof(tables_query) - qsize;
+               tbqry = tables_query + qsize;
+               if (0 == reloid)
+                   snprintf(tbqry, tsize,
+                   " where tc.relname %s'%s'"
+                   " AND n.nspname %s'%s'"
+                   , eq_string, escTableName, eq_string, pkscm);
                else
-               {
-                   strncpy_null(tables_query,
-                       "select ta.attname, ia.attnum, ic.relname, NULL, tc.relname"
-                       " from pg_attribute ta, pg_attribute ia, pg_class tc, pg_index i, pg_class ic"
-                       , sizeof(tables_query));
-                   qsize = strlen(tables_query);
-                   tsize = sizeof(tables_query) - qsize;
-                   tbqry = tables_query + qsize;
-                   if (0 == reloid)
-                       snprintf(tbqry, tsize,
-                       " where tc.relname %s'%s'"
-                       , eq_string, escTableName);
-                   else
-                       snprintf(tbqry, tsize,
-                       " where tc.oid = " FORMAT_UINT4, reloid);
-
-                   strlcat(tables_query,
-                       " AND tc.oid = i.indrelid"
-                       " AND i.indisprimary = 't'"
-                       " AND ia.attrelid = i.indexrelid"
-                       " AND ta.attrelid = i.indrelid"
-                       " AND ta.attnum = i.indkey[ia.attnum-1]"
-                       " AND ic.oid = i.indexrelid"
-                       " order by ia.attnum"
-                       , sizeof(tables_query));
-               }
+                   snprintf(tbqry, tsize,
+                   " where tc.oid = " FORMAT_UINT4
+                   , reloid);
+
+               strlcat(tables_query,
+                   " AND tc.oid = i.indrelid"
+                   " AND n.oid = tc.relnamespace"
+                   " AND i.indisprimary = 't'"
+                   " AND ia.attrelid = i.indexrelid"
+                   " AND ta.attrelid = i.indrelid"
+                   " AND ta.attnum = i.indkey[ia.attnum-1]"
+                   " AND (NOT ta.attisdropped)"
+                   " AND (NOT ia.attisdropped)"
+                   " AND ic.oid = i.indexrelid"
+                   " order by ia.attnum"
+                   , sizeof(tables_query));
                break;
            case 2:
 
                /*
                 * Simplified query to search old fashoned primary key
                 */
-               if (conn->schema_support)
-                   snprintf(tables_query, sizeof(tables_query), "select ta.attname, ia.attnum, ic.relname, n.nspname, NULL"
-                       " from pg_catalog.pg_attribute ta,"
-                       " pg_catalog.pg_attribute ia, pg_catalog.pg_class ic,"
-                       " pg_catalog.pg_index i, pg_catalog.pg_namespace n"
-                       " where ic.relname %s'%s_pkey'"
-                       " AND n.nspname %s'%s'"
-                       " AND ic.oid = i.indexrelid"
-                       " AND n.oid = ic.relnamespace"
-                       " AND ia.attrelid = i.indexrelid"
-                       " AND ta.attrelid = i.indrelid"
-                       " AND ta.attnum = i.indkey[ia.attnum-1]"
-                       " AND (NOT ta.attisdropped)"
-                       " AND (NOT ia.attisdropped)"
-                       " order by ia.attnum", eq_string, escTableName, eq_string, pkscm);
-               else
-                   snprintf(tables_query, sizeof(tables_query), "select ta.attname, ia.attnum, ic.relname, NULL, NULL"
-                       " from pg_attribute ta, pg_attribute ia, pg_class ic, pg_index i"
-                       " where ic.relname %s'%s_pkey'"
-                       " AND ic.oid = i.indexrelid"
-                       " AND ia.attrelid = i.indexrelid"
-                       " AND ta.attrelid = i.indrelid"
-                       " AND ta.attnum = i.indkey[ia.attnum-1]"
-                       " order by ia.attnum", eq_string, escTableName);
+               snprintf(tables_query, sizeof(tables_query), "select ta.attname, ia.attnum, ic.relname, n.nspname, NULL"
+                   " from pg_catalog.pg_attribute ta,"
+                   " pg_catalog.pg_attribute ia, pg_catalog.pg_class ic,"
+                   " pg_catalog.pg_index i, pg_catalog.pg_namespace n"
+                   " where ic.relname %s'%s_pkey'"
+                   " AND n.nspname %s'%s'"
+                   " AND ic.oid = i.indexrelid"
+                   " AND n.oid = ic.relnamespace"
+                   " AND ia.attrelid = i.indexrelid"
+                   " AND ta.attrelid = i.indrelid"
+                   " AND ta.attnum = i.indkey[ia.attnum-1]"
+                   " AND (NOT ta.attisdropped)"
+                   " AND (NOT ia.attisdropped)"
+                   " order by ia.attnum", eq_string, escTableName, eq_string, pkscm);
                break;
        }
        mylog("%s: tables_query='%s'\n", func, tables_query);
@@ -3921,8 +3650,7 @@ retry_public_schema:
    }
 
    /* If not found */
-   if (conn->schema_support &&
-       SQL_NO_DATA_FOUND == result)
+   if (SQL_NO_DATA_FOUND == result)
    {
        if (0 == reloid &&
            allow_public_schema(conn, szSchemaName, cbSchemaName))
@@ -4239,93 +3967,54 @@ PGAPI_ForeignKeys_old(HSTMT hstmt,
     */
    if (fk_table_needed && fk_table_needed[0] != '\0')
    {
+       char    *escSchemaName;
+
        mylog("%s: entering Foreign Key Case #2", func);
        escFkTableName = simpleCatalogEscape((SQLCHAR *) fk_table_needed, SQL_NTS, NULL, conn);
-       if (conn->schema_support)
-       {
-           char    *escSchemaName;
-
-           schema_strcat(schema_needed, "%.*s", szFkTableOwner, cbFkTableOwner, szFkTableName, cbFkTableName, conn);
-           escSchemaName = simpleCatalogEscape((SQLCHAR *) schema_needed, SQL_NTS, NULL, conn);
-           snprintf(tables_query, sizeof(tables_query), "SELECT    pt.tgargs, "
-               "       pt.tgnargs, "
-               "       pt.tgdeferrable, "
-               "       pt.tginitdeferred, "
-               "       pp1.proname, "
-               "       pp2.proname, "
-               "       pc.oid, "
-               "       pc1.oid, "
-               "       pc1.relname, "
-               "       pt.tgconstrname, pn.nspname "
-               "FROM   pg_catalog.pg_class pc, "
-               "       pg_catalog.pg_proc pp1, "
-               "       pg_catalog.pg_proc pp2, "
-               "       pg_catalog.pg_trigger pt1, "
-               "       pg_catalog.pg_trigger pt2, "
-               "       pg_catalog.pg_proc pp, "
-               "       pg_catalog.pg_trigger pt, "
-               "       pg_catalog.pg_class pc1, "
-               "       pg_catalog.pg_namespace pn, "
-               "       pg_catalog.pg_namespace pn1 "
-               "WHERE  pt.tgrelid = pc.oid "
-               "AND pp.oid = pt.tgfoid "
-               "AND pt1.tgconstrrelid = pc.oid "
-               "AND pp1.oid = pt1.tgfoid "
-               "AND pt2.tgfoid = pp2.oid "
-               "AND pt2.tgconstrrelid = pc.oid "
-               "AND ((pc.relname %s'%s') "
-               "AND (pn1.oid = pc.relnamespace) "
-               "AND (pn1.nspname %s'%s') "
-               "AND (pp.proname LIKE '%%ins') "
-               "AND (pp1.proname LIKE '%%upd') "
-               "AND (pp1.proname not LIKE '%%check%%') "
-               "AND (pp2.proname LIKE '%%del') "
-               "AND (pt1.tgrelid=pt.tgconstrrelid) "
-               "AND (pt1.tgconstrname=pt.tgconstrname) "
-               "AND (pt2.tgrelid=pt.tgconstrrelid) "
-               "AND (pt2.tgconstrname=pt.tgconstrname) "
-               "AND (pt.tgconstrrelid=pc1.oid) "
-               "AND (pc1.relnamespace=pn.oid))"
-               " order by pt.tgconstrname",
-               eq_string, escFkTableName, eq_string, escSchemaName);
-           free(escSchemaName);
-       }
-       else
-           snprintf(tables_query, sizeof(tables_query), "SELECT    pt.tgargs, "
-               "       pt.tgnargs, "
-               "       pt.tgdeferrable, "
-               "       pt.tginitdeferred, "
-               "       pp1.proname, "
-               "       pp2.proname, "
-               "       pc.oid, "
-               "       pc1.oid, "
-               "       pc1.relname, pt.tgconstrname "
-               "FROM   pg_class pc, "
-               "       pg_proc pp1, "
-               "       pg_proc pp2, "
-               "       pg_trigger pt1, "
-               "       pg_trigger pt2, "
-               "       pg_proc pp, "
-               "       pg_trigger pt, "
-               "       pg_class pc1 "
-               "WHERE  pt.tgrelid = pc.oid "
-               "AND pp.oid = pt.tgfoid "
-               "AND pt1.tgconstrrelid = pc.oid "
-               "AND pp1.oid = pt1.tgfoid "
-               "AND pt2.tgfoid = pp2.oid "
-               "AND pt2.tgconstrrelid = pc.oid "
-               "AND ((pc.relname %s'%s') "
-               "AND (pp.proname LIKE '%%ins') "
-               "AND (pp1.proname LIKE '%%upd') "
-               "AND (pp1.proname not LIKE '%%check%%') "
-               "AND (pp2.proname LIKE '%%del') "
-               "AND (pt1.tgrelid=pt.tgconstrrelid) "
-               "AND (pt1.tgconstrname=pt.tgconstrname) "
-               "AND (pt2.tgrelid=pt.tgconstrrelid) "
-               "AND (pt2.tgconstrname=pt.tgconstrname) "
-               "AND (pt.tgconstrrelid=pc1.oid)) "
-               "order by pt.tgconstrname",
-               eq_string, escFkTableName);
+       schema_strcat(schema_needed, "%.*s", szFkTableOwner, cbFkTableOwner, szFkTableName, cbFkTableName, conn);
+       escSchemaName = simpleCatalogEscape((SQLCHAR *) schema_needed, SQL_NTS, NULL, conn);
+       snprintf(tables_query, sizeof(tables_query), "SELECT    pt.tgargs, "
+           "       pt.tgnargs, "
+           "       pt.tgdeferrable, "
+           "       pt.tginitdeferred, "
+           "       pp1.proname, "
+           "       pp2.proname, "
+           "       pc.oid, "
+           "       pc1.oid, "
+           "       pc1.relname, "
+           "       pt.tgconstrname, pn.nspname "
+           "FROM   pg_catalog.pg_class pc, "
+           "       pg_catalog.pg_proc pp1, "
+           "       pg_catalog.pg_proc pp2, "
+           "       pg_catalog.pg_trigger pt1, "
+           "       pg_catalog.pg_trigger pt2, "
+           "       pg_catalog.pg_proc pp, "
+           "       pg_catalog.pg_trigger pt, "
+           "       pg_catalog.pg_class pc1, "
+           "       pg_catalog.pg_namespace pn, "
+           "       pg_catalog.pg_namespace pn1 "
+           "WHERE  pt.tgrelid = pc.oid "
+           "AND pp.oid = pt.tgfoid "
+           "AND pt1.tgconstrrelid = pc.oid "
+           "AND pp1.oid = pt1.tgfoid "
+           "AND pt2.tgfoid = pp2.oid "
+           "AND pt2.tgconstrrelid = pc.oid "
+           "AND ((pc.relname %s'%s') "
+           "AND (pn1.oid = pc.relnamespace) "
+           "AND (pn1.nspname %s'%s') "
+           "AND (pp.proname LIKE '%%ins') "
+           "AND (pp1.proname LIKE '%%upd') "
+           "AND (pp1.proname not LIKE '%%check%%') "
+           "AND (pp2.proname LIKE '%%del') "
+           "AND (pt1.tgrelid=pt.tgconstrrelid) "
+           "AND (pt1.tgconstrname=pt.tgconstrname) "
+           "AND (pt2.tgrelid=pt.tgconstrrelid) "
+           "AND (pt2.tgconstrname=pt.tgconstrname) "
+           "AND (pt.tgconstrrelid=pc1.oid) "
+           "AND (pc1.relnamespace=pn.oid))"
+           " order by pt.tgconstrname",
+           eq_string, escFkTableName, eq_string, escSchemaName);
+       free(escSchemaName);
 
        result = PGAPI_ExecDirect(htbl_stmt, (SQLCHAR *) tables_query, SQL_NTS, 0);
 
@@ -4412,15 +4101,12 @@ PGAPI_ForeignKeys_old(HSTMT hstmt,
            goto cleanup;
        }
 
-       if (conn->schema_support)
+       result = PGAPI_BindCol(htbl_stmt, 11, internal_asis_type,
+               schema_fetched, SCHEMA_NAME_STORAGE_LEN, NULL);
+       if (!SQL_SUCCEEDED(result))
        {
-           result = PGAPI_BindCol(htbl_stmt, 11, internal_asis_type,
-                   schema_fetched, SCHEMA_NAME_STORAGE_LEN, NULL);
-           if (!SQL_SUCCEEDED(result))
-           {
-               SC_error_copy(stmt, tbl_stmt, TRUE);
-               goto cleanup;
-           }
+           SC_error_copy(stmt, tbl_stmt, TRUE);
+           goto cleanup;
        }
 
        result = PGAPI_Fetch(htbl_stmt);
@@ -4614,92 +4300,53 @@ PGAPI_ForeignKeys_old(HSTMT hstmt,
     */
    else if (pk_table_needed[0] != '\0')
    {
+       char    *escSchemaName;
+
        escPkTableName = simpleCatalogEscape((SQLCHAR *) pk_table_needed, SQL_NTS, NULL, conn);
-       if (conn->schema_support)
-       {
-           char    *escSchemaName;
-
-           schema_strcat(schema_needed, "%.*s", szPkTableOwner, cbPkTableOwner, szPkTableName, cbPkTableName, conn);
-           escSchemaName = simpleCatalogEscape((SQLCHAR *) schema_needed, SQL_NTS, NULL, conn);
-           snprintf(tables_query, sizeof(tables_query), "SELECT    pt.tgargs, "
-               "   pt.tgnargs, "
-               "   pt.tgdeferrable, "
-               "   pt.tginitdeferred, "
-               "   pp1.proname, "
-               "   pp2.proname, "
-               "   pc.oid, "
-               "   pc1.oid, "
-               "   pc1.relname, "
-               "   pt.tgconstrname, pn1.nspname "
-               "FROM   pg_catalog.pg_class pc, "
-               "   pg_catalog.pg_class pc1, "
-               "   pg_catalog.pg_proc pp, "
-               "   pg_catalog.pg_proc pp1, "
-               "   pg_catalog.pg_proc pp2, "
-               "   pg_catalog.pg_trigger pt, "
-               "   pg_catalog.pg_trigger pt1, "
-               "   pg_catalog.pg_trigger pt2, "
-               "   pg_catalog.pg_namespace pn, "
-               "   pg_catalog.pg_namespace pn1 "
-               "WHERE  pc.relname %s'%s' "
-               "   AND pn.nspname %s'%s' "
-               "   AND pc.relnamespace = pn.oid "
-               "   AND pt.tgconstrrelid = pc.oid "
-               "   AND pp.oid = pt.tgfoid "
-               "   AND pp.proname Like '%%ins' "
-               "   AND pt1.tgconstrname = pt.tgconstrname "
-               "   AND pt1.tgconstrrelid = pt.tgrelid "
-               "   AND pt1.tgrelid = pc.oid "
-               "   AND pc1.oid = pt.tgrelid "
-               "   AND pp1.oid = pt1.tgfoid "
-               "   AND pp1.proname like '%%upd' "
-               "   AND (pp1.proname not like '%%check%%') "
-               "   AND pt2.tgconstrname = pt.tgconstrname "
-               "   AND pt2.tgconstrrelid = pt.tgrelid "
-               "   AND pt2.tgrelid = pc.oid "
-               "   AND pp2.oid = pt2.tgfoid "
-               "   AND pp2.proname Like '%%del' "
-               "   AND pn1.oid = pc1.relnamespace "
-               " order by pt.tgconstrname",
-               eq_string, escPkTableName, eq_string, escSchemaName);
-           free(escSchemaName);
-       }
-       else
-           snprintf(tables_query, sizeof(tables_query), "SELECT    pt.tgargs, "
-               "   pt.tgnargs, "
-               "   pt.tgdeferrable, "
-               "   pt.tginitdeferred, "
-               "   pp1.proname, "
-               "   pp2.proname, "
-               "   pc.oid, "
-               "   pc1.oid, "
-               "   pc1.relname, pt.tgconstrname "
-               "FROM   pg_class pc, "
-               "   pg_class pc1, "
-               "   pg_proc pp, "
-               "   pg_proc pp1, "
-               "   pg_proc pp2, "
-               "   pg_trigger pt, "
-               "   pg_trigger pt1, "
-               "   pg_trigger pt2 "
-               "WHERE  pc.relname %s'%s' "
-               "   AND pt.tgconstrrelid = pc.oid "
-               "   AND pp.oid = pt.tgfoid "
-               "   AND pp.proname Like '%%ins' "
-               "   AND pt1.tgconstrname = pt.tgconstrname "
-               "   AND pt1.tgconstrrelid = pt.tgrelid "
-               "   AND pt1.tgrelid = pc.oid "
-               "   AND pc1.oid = pt.tgrelid "
-               "   AND pp1.oid = pt1.tgfoid "
-               "   AND pp1.proname like '%%upd' "
-               "   AND pp1.(proname not like '%%check%%') "
-               "   AND pt2.tgconstrname = pt.tgconstrname "
-               "   AND pt2.tgconstrrelid = pt.tgrelid "
-               "   AND pt2.tgrelid = pc.oid "
-               "   AND pp2.oid = pt2.tgfoid "
-               "   AND pp2.proname Like '%%del'"
-               " order by pt.tgconstrname",
-               eq_string, escPkTableName);
+       schema_strcat(schema_needed, "%.*s", szPkTableOwner, cbPkTableOwner, szPkTableName, cbPkTableName, conn);
+       escSchemaName = simpleCatalogEscape((SQLCHAR *) schema_needed, SQL_NTS, NULL, conn);
+       snprintf(tables_query, sizeof(tables_query), "SELECT    pt.tgargs, "
+           "   pt.tgnargs, "
+           "   pt.tgdeferrable, "
+           "   pt.tginitdeferred, "
+           "   pp1.proname, "
+           "   pp2.proname, "
+           "   pc.oid, "
+           "   pc1.oid, "
+           "   pc1.relname, "
+           "   pt.tgconstrname, pn1.nspname "
+           "FROM   pg_catalog.pg_class pc, "
+           "   pg_catalog.pg_class pc1, "
+           "   pg_catalog.pg_proc pp, "
+           "   pg_catalog.pg_proc pp1, "
+           "   pg_catalog.pg_proc pp2, "
+           "   pg_catalog.pg_trigger pt, "
+           "   pg_catalog.pg_trigger pt1, "
+           "   pg_catalog.pg_trigger pt2, "
+           "   pg_catalog.pg_namespace pn, "
+           "   pg_catalog.pg_namespace pn1 "
+           "WHERE  pc.relname %s'%s' "
+           "   AND pn.nspname %s'%s' "
+           "   AND pc.relnamespace = pn.oid "
+           "   AND pt.tgconstrrelid = pc.oid "
+           "   AND pp.oid = pt.tgfoid "
+           "   AND pp.proname Like '%%ins' "
+           "   AND pt1.tgconstrname = pt.tgconstrname "
+           "   AND pt1.tgconstrrelid = pt.tgrelid "
+           "   AND pt1.tgrelid = pc.oid "
+           "   AND pc1.oid = pt.tgrelid "
+           "   AND pp1.oid = pt1.tgfoid "
+           "   AND pp1.proname like '%%upd' "
+           "   AND (pp1.proname not like '%%check%%') "
+           "   AND pt2.tgconstrname = pt.tgconstrname "
+           "   AND pt2.tgconstrrelid = pt.tgrelid "
+           "   AND pt2.tgrelid = pc.oid "
+           "   AND pp2.oid = pt2.tgfoid "
+           "   AND pp2.proname Like '%%del' "
+           "   AND pn1.oid = pc1.relnamespace "
+           " order by pt.tgconstrname",
+           eq_string, escPkTableName, eq_string, escSchemaName);
+       free(escSchemaName);
 
        result = PGAPI_ExecDirect(htbl_stmt, (SQLCHAR *) tables_query, SQL_NTS, 0);
        if (!SQL_SUCCEEDED(result))
@@ -4785,15 +4432,12 @@ PGAPI_ForeignKeys_old(HSTMT hstmt,
            goto cleanup;
        }
 
-       if (conn->schema_support)
+       result = PGAPI_BindCol(htbl_stmt, 11, internal_asis_type,
+               schema_fetched, SCHEMA_NAME_STORAGE_LEN, NULL);
+       if (!SQL_SUCCEEDED(result))
        {
-           result = PGAPI_BindCol(htbl_stmt, 11, internal_asis_type,
-                   schema_fetched, SCHEMA_NAME_STORAGE_LEN, NULL);
-           if (!SQL_SUCCEEDED(result))
-           {
-               SC_error_copy(stmt, tbl_stmt, TRUE);
-               goto cleanup;
-           }
+           SC_error_copy(stmt, tbl_stmt, TRUE);
+           goto cleanup;
        }
 
        result = PGAPI_Fetch(htbl_stmt);
@@ -5057,11 +4701,6 @@ PGAPI_ProcedureColumns(HSTMT hstmt,
 
    mylog("%s: entering...\n", func);
 
-   if (PG_VERSION_LT(conn, 6.5))
-   {
-       SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, "Version is too old", func);
-       return SQL_ERROR;
-   }
    if (result = SC_initialize_and_recycle(stmt), SQL_SUCCESS != result)
        return result;
    search_pattern = (0 == (flag & PODBC_NOT_SEARCH_PATTERN));
@@ -5078,64 +4717,50 @@ PGAPI_ProcedureColumns(HSTMT hstmt,
        escProcName = simpleCatalogEscape(szProcName, cbProcName, NULL, conn);
    }
    op_string = gen_opestr(like_or_eq, conn);
-   if (conn->schema_support)
-   {
-       strcpy(proc_query, "select proname, proretset, prorettype, "
-               "pronargs, proargtypes, nspname, p.oid");
-       ret_col = ext_pos = 7;
-       poid_pos = 6;
+   strcpy(proc_query, "select proname, proretset, prorettype, "
+           "pronargs, proargtypes, nspname, p.oid");
+   ret_col = ext_pos = 7;
+   poid_pos = 6;
 #ifdef PRORET_COUNT
-       strcat(proc_query, ", atttypid, attname");
-       attid_pos = ext_pos;
-       attname_pos = ext_pos + 1;
-       ret_col += 2;
-       ext_pos = ret_col;
+   strcat(proc_query, ", atttypid, attname");
+   attid_pos = ext_pos;
+   attname_pos = ext_pos + 1;
+   ret_col += 2;
+   ext_pos = ret_col;
 #endif /* PRORET_COUNT */
-       if (PG_VERSION_GE(conn, 8.0))
-       {
-           strcat(proc_query, ", proargnames");
-           ret_col++;
-       }
-       if (PG_VERSION_GE(conn, 8.1))
-       {
-           strcat(proc_query, ", proargmodes, proallargtypes");
-           ret_col += 2;
-       }
+   if (PG_VERSION_GE(conn, 8.0))
+   {
+       strcat(proc_query, ", proargnames");
+       ret_col++;
+   }
+   if (PG_VERSION_GE(conn, 8.1))
+   {
+       strcat(proc_query, ", proargmodes, proallargtypes");
+       ret_col += 2;
+   }
 #ifdef PRORET_COUNT
-       strcat(proc_query, " from ((pg_catalog.pg_namespace n inner join"
-                  " pg_catalog.pg_proc p on p.pronamespace = n.oid)"
-           " inner join pg_type t on t.oid = p.prorettype)"
-           " left outer join pg_attribute a on a.attrelid = t.typrelid "
-           " and attnum > 0 and not attisdropped where");
+   strcat(proc_query, " from ((pg_catalog.pg_namespace n inner join"
+              " pg_catalog.pg_proc p on p.pronamespace = n.oid)"
+       " inner join pg_type t on t.oid = p.prorettype)"
+       " left outer join pg_attribute a on a.attrelid = t.typrelid "
+       " and attnum > 0 and not attisdropped where");
 #else
-       strcat(proc_query, " from pg_catalog.pg_namespace n,"
-                  " pg_catalog.pg_proc p where");
-                  " p.pronamespace = n.oid  and"
-                  " (not proretset) and");
+   strcat(proc_query, " from pg_catalog.pg_namespace n,"
+              " pg_catalog.pg_proc p where");
+              " p.pronamespace = n.oid  and"
+              " (not proretset) and");
 #endif /* PRORET_COUNT */
+   snprintf_add(proc_query, sizeof(proc_query),
+                " has_function_privilege(p.oid, 'EXECUTE')");
+   if (IS_VALID_NAME(escSchemaName))
        snprintf_add(proc_query, sizeof(proc_query),
-                    " has_function_privilege(p.oid, 'EXECUTE')");
-       if (IS_VALID_NAME(escSchemaName))
-           snprintf_add(proc_query, sizeof(proc_query),
-                    " and nspname %s'%s'",
-                    op_string, escSchemaName);
-       if (escProcName)
-           snprintf_add(proc_query, sizeof(proc_query),
-                        " and proname %s'%s'", op_string, escProcName);
-       snprintf_add(proc_query, sizeof(proc_query),
-                    " order by nspname, proname, p.oid, attnum");
-   }
-   else
-   {
-       strcpy(proc_query, "select proname, proretset, prorettype, "
-               "pronargs, proargtypes from pg_proc where "
-               "(not proretset)");
-       ret_col = 5;
-       if (escProcName)
-           snprintf_add(proc_query, sizeof(proc_query), " and proname %s'%s'", op_string, escProcName);
+                " and nspname %s'%s'",
+                op_string, escSchemaName);
+   if (escProcName)
        snprintf_add(proc_query, sizeof(proc_query),
-                    " order by proname, proretset");
-   }
+                    " and proname %s'%s'", op_string, escProcName);
+   snprintf_add(proc_query, sizeof(proc_query),
+                " order by nspname, proname, p.oid, attnum");
    if (tres = CC_send_query(conn, proc_query, NULL, IGNORE_ABORT_ON_CONN, stmt), !QR_command_maybe_successful(tres))
    {
        SC_set_error(stmt, STMT_EXEC_ERROR, "PGAPI_ProcedureColumns query error", func);
@@ -5193,10 +4818,7 @@ PGAPI_ProcedureColumns(HSTMT hstmt,
        tcount = QR_get_num_total_tuples(tres);
    for (i = 0, poid = 0; i < tcount; i++)
    {
-       if (conn->schema_support)
-           schema_name = GET_SCHEMA_NAME(QR_get_value_backend_text(tres, i, 5));
-       else
-           schema_name = NULL;
+       schema_name = GET_SCHEMA_NAME(QR_get_value_backend_text(tres, i, 5));
        procname = QR_get_value_backend_text(tres, i, 0);
        retset = QR_get_value_backend_text(tres, i, 1);
        pgtype = QR_get_value_backend_int(tres, i, 2, NULL);
@@ -5460,11 +5082,6 @@ PGAPI_Procedures(HSTMT hstmt,
 
    mylog("%s: entering... scnm=%p len=%d\n", func, szProcOwner, cbProcOwner);
 
-   if (PG_VERSION_LT(conn, 6.5))
-   {
-       SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, "Version is too old", func);
-       return SQL_ERROR;
-   }
    if (result = SC_initialize_and_recycle(stmt), SQL_SUCCESS != result)
        return result;
 
@@ -5485,34 +5102,18 @@ PGAPI_Procedures(HSTMT hstmt,
     * The following seems the simplest implementation
     */
    op_string = gen_opestr(like_or_eq, conn);
-   if (conn->schema_support)
-   {
-       strcpy(proc_query, "select '' as " "PROCEDURE_CAT" ", nspname as " "PROCEDURE_SCHEM" ","
-       " proname as " "PROCEDURE_NAME" ", '' as " "NUM_INPUT_PARAMS" ","
-          " '' as " "NUM_OUTPUT_PARAMS" ", '' as " "NUM_RESULT_SETS" ","
-          " '' as " "REMARKS" ","
-          " case when prorettype = 0 then 1::int2 else 2::int2 end"
-          " as "         "PROCEDURE_TYPE" " from pg_catalog.pg_namespace,"
-          " pg_catalog.pg_proc"
-         " where pg_proc.pronamespace = pg_namespace.oid");
-       schema_strcat1(proc_query, " and nspname %s'%.*s'", op_string, escSchemaName, SQL_NTS, szProcName, cbProcName, conn);
-       if (IS_VALID_NAME(escProcName))
-           snprintf_add(proc_query, sizeof(proc_query),
-                    " and proname %s'%s'", op_string, escProcName);
-   }
-   else
-   {
-       snprintf(proc_query, sizeof(proc_query),
-                "select '' as " "PROCEDURE_CAT" ", '' as " "PROCEDURE_SCHEM" ","
-                " proname as " "PROCEDURE_NAME" ", '' as " "NUM_INPUT_PARAMS" ","
-                " '' as " "NUM_OUTPUT_PARAMS" ", '' as " "NUM_RESULT_SETS" ","
-                " '' as " "REMARKS" ","
-                " case when prorettype = 0 then 1::int2 else 2::int2 end as " "PROCEDURE_TYPE" " from pg_proc");
-       if (IS_VALID_NAME(escSchemaName))
-           snprintf_add(proc_query, sizeof(proc_query),
-                " where proname %s'%s'",
-                op_string, escSchemaName);
-   }
+   strcpy(proc_query, "select '' as " "PROCEDURE_CAT" ", nspname as " "PROCEDURE_SCHEM" ","
+   " proname as " "PROCEDURE_NAME" ", '' as " "NUM_INPUT_PARAMS" ","
+      " '' as " "NUM_OUTPUT_PARAMS" ", '' as " "NUM_RESULT_SETS" ","
+      " '' as " "REMARKS" ","
+      " case when prorettype = 0 then 1::int2 else 2::int2 end"
+      " as "         "PROCEDURE_TYPE" " from pg_catalog.pg_namespace,"
+      " pg_catalog.pg_proc"
+     " where pg_proc.pronamespace = pg_namespace.oid");
+   schema_strcat1(proc_query, " and nspname %s'%.*s'", op_string, escSchemaName, SQL_NTS, szProcName, cbProcName, conn);
+   if (IS_VALID_NAME(escProcName))
+       snprintf_add(proc_query, sizeof(proc_query),
+                " and proname %s'%s'", op_string, escProcName);
 
    if (res = CC_send_query(conn, proc_query, NULL, IGNORE_ABORT_ON_CONN, stmt), !QR_command_maybe_successful(res))
    {
@@ -5673,26 +5274,18 @@ retry_public_schema:
        escSchemaName = simpleCatalogEscape(szSchemaName, cbSchemaName, NULL, conn);
 
    op_string = gen_opestr(like_or_eq, conn);
-   if (conn->schema_support)
-       strncpy_null(proc_query, "select relname, usename, relacl, nspname"
-       " from pg_catalog.pg_namespace, pg_catalog.pg_class ,"
-       " pg_catalog.pg_user where", sizeof(proc_query));
-   else
-       strncpy_null(proc_query, "select relname, usename, relacl"
-       " from pg_class , pg_user where", sizeof(proc_query));
-   if (conn->schema_support)
-   {
-       if (escSchemaName)
-           schema_strcat1(proc_query, " nspname %s'%.*s' and", op_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
-   }
+   strncpy_null(proc_query, "select relname, usename, relacl, nspname"
+   " from pg_catalog.pg_namespace, pg_catalog.pg_class ,"
+   " pg_catalog.pg_user where", sizeof(proc_query));
+   if (escSchemaName)
+       schema_strcat1(proc_query, " nspname %s'%.*s' and", op_string, escSchemaName, SQL_NTS, szTableName, cbTableName, conn);
+
    if (escTableName)
        snprintf_add(proc_query, sizeof(proc_query), " relname %s'%s' and", op_string, escTableName);
-   if (conn->schema_support)
-   {
-       strcat(proc_query, " pg_namespace.oid = relnamespace and relkind in ('r', 'v') and");
-       if ((!escTableName) && (!escSchemaName))
-           strcat(proc_query, " nspname not in ('pg_catalog', 'information_schema') and");
-   }
+   strcat(proc_query, " pg_namespace.oid = relnamespace and relkind in ('r', 'v') and");
+   if ((!escTableName) && (!escSchemaName))
+       strcat(proc_query, " nspname not in ('pg_catalog', 'information_schema') and");
+
    strcat(proc_query, " pg_user.usesysid = relowner");
    if (wres = CC_send_query(conn, proc_query, NULL, IGNORE_ABORT_ON_CONN, stmt), !QR_command_maybe_successful(wres))
    {
@@ -5702,8 +5295,7 @@ retry_public_schema:
    }
    tablecount = (Int4) QR_get_num_cached_tuples(wres);
    /* If not found */
-   if (conn->schema_support &&
-       (flag & PODBC_SEARCH_PUBLIC_SCHEMA) != 0 &&
+   if ((flag & PODBC_SEARCH_PUBLIC_SCHEMA) != 0 &&
        0 == tablecount)
    {
        if (allow_public_schema(conn, szSchemaName, cbSchemaName))
@@ -5795,8 +5387,7 @@ mylog("guid=%s\n", uid);
        }
        reln = QR_get_value_backend_text(wres, i, 0);
        owner = QR_get_value_backend_text(wres, i, 1);
-       if (conn->schema_support)
-           schnm = QR_get_value_backend_text(wres, i, 3);
+       schnm = QR_get_value_backend_text(wres, i, 3);
        /* The owner has all privileges */
        useracl_upd(useracl, allures, owner, ALL_PRIVILIGES);
        for (j = 0; j < usercount; j++)
@@ -5819,10 +5410,7 @@ mylog("guid=%s\n", uid);
                }
                tuple = QR_AddNew(res);
                set_tuplefield_string(&tuple[0], CurrCat(conn));
-               if (conn->schema_support)
-                   set_tuplefield_string(&tuple[1], GET_SCHEMA_NAME(schnm));
-               else
-                   set_tuplefield_string(&tuple[1], NULL_STRING);
+               set_tuplefield_string(&tuple[1], GET_SCHEMA_NAME(schnm));
                set_tuplefield_string(&tuple[2], reln);
                if (su || sys)
                    set_tuplefield_string(&tuple[3], "_SYSTEM");
@@ -5900,6 +5488,7 @@ PGAPI_ForeignKeys_new(HSTMT hstmt,
    char        *pk_table_needed = NULL, *escTableName = NULL;
    char        *fk_table_needed = NULL;
    char        schema_needed[SCHEMA_NAME_STORAGE_LEN + 1];
+   char        *escSchemaName;
    char        catName[SCHEMA_NAME_STORAGE_LEN],
            scmName1[SCHEMA_NAME_STORAGE_LEN],
            scmName2[SCHEMA_NAME_STORAGE_LEN];
@@ -5949,19 +5538,15 @@ PGAPI_ForeignKeys_new(HSTMT hstmt,
        goto cleanup;
    }
 
-   if (conn->schema_support)
-   {
-       char    *escSchemaName;
-
-       if (NULL != CurrCat(conn))
-           snprintf(catName, sizeof(catName), "'%s'::name", CurrCat(conn));
-       else
-           strcpy(catName, "NULL::name");
-       strcpy(scmName1, "n2.nspname");
-       strcpy(scmName2, "n1.nspname");
-       escSchemaName = simpleCatalogEscape((SQLCHAR *) schema_needed, SQL_NTS, NULL, conn);
+   if (NULL != CurrCat(conn))
+       snprintf(catName, sizeof(catName), "'%s'::name", CurrCat(conn));
+   else
+       strcpy(catName, "NULL::name");
+   strcpy(scmName1, "n2.nspname");
+   strcpy(scmName2, "n1.nspname");
+   escSchemaName = simpleCatalogEscape((SQLCHAR *) schema_needed, SQL_NTS, NULL, conn);
 
-       snprintf(tables_query, sizeof(tables_query),
+   snprintf(tables_query, sizeof(tables_query),
        "select"
        "   %s as PKTABLE_CAT"
        ",\n    %s as PKTABLE_SCHEM"
@@ -6052,102 +5637,17 @@ PGAPI_ForeignKeys_new(HSTMT hstmt,
        , eq_string, escTableName
        , eq_string, escSchemaName);
 
-       free(escSchemaName);
-       if (NULL != pk_table_needed &&
-           NULL != fk_table_needed)
-       {
-           free(escTableName);
-           escTableName = simpleCatalogEscape((SQLCHAR *) pk_table_needed, SQL_NTS, NULL, conn);
-           snprintf_add(tables_query, sizeof(tables_query),
-                   "\n where c2.relname %s'%s'",
-                   eq_string, escTableName);
-       }
-       strcat(tables_query, "\n  order by ref.oid, ref.i");
-   }
-   else
+   free(escSchemaName);
+   if (NULL != pk_table_needed &&
+       NULL != fk_table_needed)
    {
-       strcpy(catName, "NULL::name");
-       strcpy(scmName1, "NULL::name");
-       strcpy(scmName2, "NULL::name");
-
-       snprintf(tables_query, sizeof(tables_query),
-       "select %s as PKTABLE_CAT"
-       ",\n    %s as PKTABLE_SCHEM"
-       ",\n    c2.relname as PKTABLE_NAME"
-       ",\n    a2.attname as PKCOLUMN_NAME"
-       ",\n    %s as FKTABLE_CAT"
-       ",\n    %s as FKTABLE_SCHEM"
-       ",\n    c1.relname as FKTABLE_NAME"
-       ",\n    a1.attname as FKCOLUMN_NAME"
-       ",\n    i::int2 as KEY_SEQ"
-       ",\n    case confupdtype"
-       "\n     when 'c' then %d::int2"
-       "\n     when 'n' then %d::int2"
-       "\n     when 'd' then %d::int2"
-       "\n     when 'r' then %d::int2"
-       "\n     else %d::int2"
-       "\n end as UPDATE_RULE"
-       ",\n    case confdeltype"
-       "\n     when 'c' then %d::int2"
-       "\n     when 'n' then %d::int2"
-       "\n     when 'd' then %d::int2"
-       "\n     when 'r' then %d::int2"
-       "\n     else %d::int2"
-       "\n end as DELETE_RULE"
-       ",\n    conname as FK_NAME"
-       ",\n    NULL::name as PK_NAME"
-#if (ODBCVER >= 0x0300)
-       ",\n    case"
-       "\n     when condeferrable then"
-       "\n         case"
-       "\n         when condeferred then %d::int2"
-       "\n         else %d::int2"
-       "\n         end"
-       "\n     else %d::int2"
-       "\n end as DEFERRABLITY"
-#endif /* ODBCVER */
-       "\n from"
-       "\n (select conrelid, conkey, confrelid, confkey"
-       ",\n     generate_series(array_lower(conkey, 1), array_upper(conkey, 1)) as i"
-       ",\n     confupdtype, confdeltype, conname"
-       ",\n     condeferrable, condeferred"
-       "\n  from pg_catalog.pg_constraint cn"
-       ",\n    pg_catalog.pg_class c"
-       "\n  where contype = 'f' %s"
-       "\n   and  relname %s'%s'"
-       "\n ) ref"
-       ",\n pg_catalog.pg_class c1"
-       ",\n pg_catalog.pg_attribute a1"
-       ",\n pg_catalog.pg_class c2"
-       ",\n pg_catalog.pg_attribute a2"
-       "\n where c1.oid = ref.conrelid"
-       "\n  and  c2.oid = ref.confrelid"
-       "\n  and  a1.attrelid = c1.oid"
-       "\n  and  a1.attnum = conkey[i]"
-       "\n  and  a2.attrelid = c2.oid"
-       "\n  and  a2.attnum = confkey[i]"
-       "\n  order by ref.oid, ref.i"
-       , catName
-       , scmName1
-       , catName
-       , scmName2
-       , SQL_CASCADE
-       , SQL_SET_NULL
-       , SQL_SET_DEFAULT
-       , SQL_RESTRICT
-       , SQL_NO_ACTION
-       , SQL_CASCADE
-       , SQL_SET_NULL
-       , SQL_SET_DEFAULT
-       , SQL_RESTRICT
-       , SQL_NO_ACTION
-#if (ODBCVER >= 0x0300)
-       , SQL_INITIALLY_DEFERRED
-       , SQL_INITIALLY_IMMEDIATE
-       , SQL_NOT_DEFERRABLE
-#endif /* ODBCVER */
-       , relqual, eq_string, escTableName);
+       free(escTableName);
+       escTableName = simpleCatalogEscape((SQLCHAR *) pk_table_needed, SQL_NTS, NULL, conn);
+       snprintf_add(tables_query, sizeof(tables_query),
+               "\n where c2.relname %s'%s'",
+               eq_string, escTableName);
    }
+   strcat(tables_query, "\n  order by ref.oid, ref.i");
 
    if (res = CC_send_query(conn, tables_query, NULL, IGNORE_ABORT_ON_CONN, stmt), !QR_command_maybe_successful(res))
    {
index 86de77f0cd5c8c812971869c0d6502416e9ba8df..e85ef2d2cbe96225de54c8cefdba9b122b3694e8 100644 (file)
--- a/info30.c
+++ b/info30.c
@@ -187,23 +187,19 @@ PGAPI_GetInfo30(HDBC hdbc, SQLUSMALLINT fInfoType, PTR rgbInfoValue,
            break;
        case SQL_CREATE_SCHEMA:
            len = 4;
-           if (conn->schema_support)
-               value = SQL_CS_CREATE_SCHEMA | SQL_CS_AUTHORIZATION;
-           else
-               value = 0;
+           value = SQL_CS_CREATE_SCHEMA | SQL_CS_AUTHORIZATION;
            break;
        case SQL_CREATE_TABLE:
            len = 4;
-           value = SQL_CT_CREATE_TABLE | SQL_CT_COLUMN_CONSTRAINT
-               | SQL_CT_COLUMN_DEFAULT;
-           if (PG_VERSION_GE(conn, 6.5))
-               value |= SQL_CT_GLOBAL_TEMPORARY;
-           if (PG_VERSION_GE(conn, 7.0))
-               value |= SQL_CT_TABLE_CONSTRAINT
-                   | SQL_CT_CONSTRAINT_NAME_DEFINITION
-                   | SQL_CT_CONSTRAINT_INITIALLY_DEFERRED
-                   | SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE
-                   | SQL_CT_CONSTRAINT_DEFERRABLE;
+           value = SQL_CT_CREATE_TABLE
+               | SQL_CT_COLUMN_CONSTRAINT
+               | SQL_CT_COLUMN_DEFAULT
+               | SQL_CT_GLOBAL_TEMPORARY
+               | SQL_CT_TABLE_CONSTRAINT
+               | SQL_CT_CONSTRAINT_NAME_DEFINITION
+               | SQL_CT_CONSTRAINT_INITIALLY_DEFERRED
+               | SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE
+               | SQL_CT_CONSTRAINT_DEFERRABLE;
            break;
        case SQL_CREATE_TRANSLATION:
            len = 4;
@@ -239,16 +235,12 @@ PGAPI_GetInfo30(HDBC hdbc, SQLUSMALLINT fInfoType, PTR rgbInfoValue,
            break;
        case SQL_DROP_SCHEMA:
            len = 4;
-           if (conn->schema_support)
-               value = SQL_DS_DROP_SCHEMA | SQL_DS_RESTRICT | SQL_DS_CASCADE;
-           else
-               value = 0;
+           value = SQL_DS_DROP_SCHEMA | SQL_DS_RESTRICT | SQL_DS_CASCADE;
            break;
        case SQL_DROP_TABLE:
            len = 4;
            value = SQL_DT_DROP_TABLE;
-           if (PG_VERSION_GT(conn, 7.2)) /* hopefully */
-               value |= (SQL_DT_RESTRICT | SQL_DT_CASCADE);
+           value |= (SQL_DT_RESTRICT | SQL_DT_CASCADE);
            break;
        case SQL_DROP_TRANSLATION:
            len = 4;
@@ -257,8 +249,7 @@ PGAPI_GetInfo30(HDBC hdbc, SQLUSMALLINT fInfoType, PTR rgbInfoValue,
        case SQL_DROP_VIEW:
            len = 4;
            value = SQL_DV_DROP_VIEW;
-           if (PG_VERSION_GT(conn, 7.2)) /* hopefully */
-               value |= (SQL_DV_RESTRICT | SQL_DV_CASCADE);
+           value |= (SQL_DV_RESTRICT | SQL_DV_CASCADE);
            break;
        case SQL_INDEX_KEYWORDS:
            len = 4;
@@ -275,9 +266,9 @@ PGAPI_GetInfo30(HDBC hdbc, SQLUSMALLINT fInfoType, PTR rgbInfoValue,
            break;
        case SQL_MAX_IDENTIFIER_LEN:
            len = 2;
-           value = 32;
-           if (PG_VERSION_GT(conn, 7.2))
-               value = 64;
+           /* FIXME: This is the default, but the server might be compiled
+            * with a different NAMEDATALEN value */
+           value = 64;
            break;
        case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
            len = 0;
@@ -327,12 +318,11 @@ PGAPI_GetInfo30(HDBC hdbc, SQLUSMALLINT fInfoType, PTR rgbInfoValue,
            break;
        case SQL_SQL92_RELATIONAL_JOIN_OPERATORS:
            len = 4;
-           if (PG_VERSION_GE(conn, 7.1))
-               value = SQL_SRJO_CROSS_JOIN | SQL_SRJO_EXCEPT_JOIN
-                   | SQL_SRJO_FULL_OUTER_JOIN | SQL_SRJO_INNER_JOIN
-                   | SQL_SRJO_INTERSECT_JOIN | SQL_SRJO_LEFT_OUTER_JOIN
-                   | SQL_SRJO_NATURAL_JOIN | SQL_SRJO_RIGHT_OUTER_JOIN
-                   | SQL_SRJO_UNION_JOIN;
+           value = SQL_SRJO_CROSS_JOIN | SQL_SRJO_EXCEPT_JOIN
+               | SQL_SRJO_FULL_OUTER_JOIN | SQL_SRJO_INNER_JOIN
+               | SQL_SRJO_INTERSECT_JOIN | SQL_SRJO_LEFT_OUTER_JOIN
+               | SQL_SRJO_NATURAL_JOIN | SQL_SRJO_RIGHT_OUTER_JOIN
+               | SQL_SRJO_UNION_JOIN;
            break;
        case SQL_SQL92_REVOKE:
            len = 4;
diff --git a/misc.c b/misc.c
index 29d55b62ddb967cd92dd0da938b0e7b268ef0685..90618ab3feafd8d50f16f1059007ade7cf34a687 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -224,7 +224,7 @@ schema_strcat(char *buf, const char *fmt, const SQLCHAR *s, SQLLEN len, const SQ
         * the CURRENT_SCHEMA() though it doesn't worth the
         * naming.
         */
-       if (conn->schema_support && tbname && (tbnmlen > 0 || tbnmlen == SQL_NTS))
+       if (tbname && (tbnmlen > 0 || tbnmlen == SQL_NTS))
            return my_strcat(buf, fmt, CC_get_current_schema(conn), SQL_NTS);
        return NULL;
    }
@@ -274,7 +274,7 @@ schema_strcat1(char *buf, const char *fmt, const char *s1, const char *s, ssize_
 {
    if (!s || 0 == len)
    {
-       if (conn->schema_support && tbname && (tbnmlen > 0 || tbnmlen == SQL_NTS))
+       if (tbname && (tbnmlen > 0 || tbnmlen == SQL_NTS))
            return my_strcat1(buf, fmt, s1, CC_get_current_schema(conn), SQL_NTS);
        return NULL;
    }
index 2f7b594a1ef1e3b9effbf8df699ed1bc7425cc70..b43a66ba5e77b7228ee73da539d9050d1e17723d 100644 (file)
@@ -455,31 +455,6 @@ CC_lookup_cs_new(ConnectionClass *self)
    QR_Destructor(res);
    return encstr;
 }
-static char *
-CC_lookup_cs_old(ConnectionClass *self)
-{
-   char        *encstr = NULL;
-   HSTMT       hstmt;
-   RETCODE     result;
-
-   result = PGAPI_AllocStmt(self, &hstmt, 0);
-   if (!SQL_SUCCEEDED(result))
-       return encstr;
-
-   result = PGAPI_ExecDirect(hstmt, (SQLCHAR *) "Show Client_Encoding", SQL_NTS, 0);
-   if (result == SQL_SUCCESS_WITH_INFO)
-   {
-       SQLCHAR     sqlState[8];
-       char        errormsg[128], enc[32];
-
-       if (PGAPI_Error(NULL, NULL, hstmt, sqlState, NULL, (SQLCHAR *) errormsg,
-           sizeof(errormsg), NULL) == SQL_SUCCESS &&
-           sscanf(errormsg, "%*s %*s %*s %*s %*s %s", enc) > 0)
-           encstr = strdup(enc);
-   }
-   PGAPI_FreeStmt(hstmt, SQL_DROP);
-   return encstr;
-}
 
 /*
  * This function works under Windows or Unicode case only.
@@ -514,11 +489,11 @@ const char * get_environment_encoding(const ConnectionClass *conn, const char *s
            wenc = "SJIS";
            break;
        case 936:
-           if (!bStartup && PG_VERSION_GT(conn, 7.2))
+           if (!bStartup)
                wenc = "GBK";
            break;
        case 949:
-           if (!bStartup && PG_VERSION_GT(conn, 7.2))
+           if (!bStartup)
                wenc = "UHC";
            break;
        case 950:
@@ -531,8 +506,7 @@ const char * get_environment_encoding(const ConnectionClass *conn, const char *s
            wenc = "WIN1251";
            break;
        case 1256:
-           if (PG_VERSION_GE(conn, 7.3))
-               wenc = "WIN1256";
+           wenc = "WIN1256";
            break;
        case 1252:
            if (strnicmp(currenc, "LATIN", 5) == 0)
@@ -578,8 +552,6 @@ CC_lookup_characterset(ConnectionClass *self)
        encspec = strdup(self->original_client_encoding);
    if (self->current_client_encoding)
        currenc = strdup(self->current_client_encoding);
-   else if (PG_VERSION_LT(self, 7.2))
-       currenc = CC_lookup_cs_old(self);
    else
        currenc = CC_lookup_cs_new(self);
    tencstr = encspec ? encspec : currenc;
index fc921098caf3689d4dfe0e344acaed32950e93f5..488a102804b685ef1b6d6b4026859a5e6e3dfd60 100644 (file)
--- a/odbcapi.c
+++ b/odbcapi.c
@@ -350,8 +350,7 @@ SQLExecDirect(HSTMT StatementHandle,
    mylog("[%s]", func);
    ENTER_STMT_CS(stmt);
    SC_clear_error(stmt);
-   if (PG_VERSION_GE(SC_get_conn(stmt), 7.4))
-       flag |= PODBC_WITH_HOLD;
+   flag |= PODBC_WITH_HOLD;
    if (SC_opencheck(stmt, func))
        ret = SQL_ERROR;
    else
@@ -375,8 +374,7 @@ SQLExecute(HSTMT StatementHandle)
    mylog("[%s]", func);
    ENTER_STMT_CS(stmt);
    SC_clear_error(stmt);
-   if (PG_VERSION_GE(SC_get_conn(stmt), 7.4))
-       flag |= PODBC_WITH_HOLD;
+   flag |= PODBC_WITH_HOLD;
    if (SC_opencheck(stmt, func))
        ret = SQL_ERROR;
    else
index a7a09808287567b8d0db752f822a62bc52a22e3e..c5468017feb56fcc7ec6dc58945efadc3ec790d6 100644 (file)
@@ -303,8 +303,7 @@ SQLExecDirectW(HSTMT StatementHandle,
    stxt = ucs2_to_utf8(StatementText, TextLength, &slen, FALSE);
    ENTER_STMT_CS(stmt);
    SC_clear_error(stmt);
-   if (PG_VERSION_GE(SC_get_conn(stmt), 7.4))
-       flag |= PODBC_WITH_HOLD;
+   flag |= PODBC_WITH_HOLD;
    StartRollbackState(stmt);
    if (SC_opencheck(stmt, func))
        ret = SQL_ERROR;
index 3f31a67c3f937b4a3f137e30caca12d2cbe42230..0d53c5e909100a0918dff1c43912af89eb06eda7 100644 (file)
--- a/options.c
+++ b/options.c
@@ -413,17 +413,12 @@ PGAPI_SetConnectOption(HDBC hdbc,
            switch (vParam)
            {
                case SQL_TXN_SERIALIZABLE:
-                   if (PG_VERSION_GE(conn, 6.5) &&
-                       PG_VERSION_LE(conn, 7.0))
-                       retval = SQL_ERROR;
                    break;
                case SQL_TXN_REPEATABLE_READ:
                    if (PG_VERSION_LT(conn, 8.0))
                        retval = SQL_ERROR;
                    break;
                case SQL_TXN_READ_COMMITTED:
-                   if (PG_VERSION_LT(conn, 6.5))
-                       retval = SQL_ERROR;
                    break;
                case SQL_TXN_READ_UNCOMMITTED:
                    if (PG_VERSION_LT(conn, 8.0))
diff --git a/parse.c b/parse.c
index 5aa7723786309ef0b9bf08ed0648e24dc66c3f24..46dd535058821634b9400beb4246ab01bed9ab4f 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -709,76 +709,61 @@ COL_INFO **coli)
    *coli = NULL;
    if (NAME_IS_NULL(table_name))
        return TRUE;
-   if (conn->schema_support)
+   if (NAME_IS_NULL(*schema_name))
    {
-       if (NAME_IS_NULL(*schema_name))
+       const char *curschema = CC_get_current_schema(conn);
+       /*
+        * Though current_schema() doesn't have
+        * much sense in PostgreSQL, we first
+        * check the current_schema() when no
+        * explicit schema name is specified.
+        */
+       for (colidx = 0; colidx < conn->ntables; colidx++)
        {
-           const char *curschema = CC_get_current_schema(conn);
-           /*
-            * Though current_schema() doesn't have
-            * much sense in PostgreSQL, we first
-            * check the current_schema() when no
-            * explicit schema name is specified.
-            */
-           for (colidx = 0; colidx < conn->ntables; colidx++)
+           if (!NAMEICMP(conn->col_info[colidx]->table_name, table_name) &&
+               !stricmp(SAFE_NAME(conn->col_info[colidx]->schema_name), curschema))
            {
-               if (!NAMEICMP(conn->col_info[colidx]->table_name, table_name) &&
-                   !stricmp(SAFE_NAME(conn->col_info[colidx]->schema_name), curschema))
-               {
-                   mylog("FOUND col_info table='%s' current schema='%s'\n", PRINT_NAME(table_name), curschema);
-                   found = TRUE;
-                   STR_TO_NAME(*schema_name, curschema);
-                   break;
-               }
-           }
-           if (!found)
-           {
-               QResultClass    *res;
-               char        token[256];
-               BOOL        tblFound = FALSE;
-
-               /*
-                * We also have to check as follows.
-                */
-               snprintf(token, sizeof(token),
-                        "select nspname from pg_namespace n, pg_class c"
-                        " where c.relnamespace=n.oid and c.oid='\"%s\"'::regclass",
-                        SAFE_NAME(table_name));
-               res = CC_send_query(conn, token, NULL, ROLLBACK_ON_ERROR | IGNORE_ABORT_ON_CONN, NULL);
-               if (QR_command_maybe_successful(res))
-               {
-                   if (QR_get_num_total_tuples(res) == 1)
-                   {
-                       tblFound = TRUE;
-                       STR_TO_NAME(*schema_name, QR_get_value_backend_text(res, 0, 0));
-                   }
-               }
-               QR_Destructor(res);
-               if (!tblFound)
-                   return FALSE;
+               mylog("FOUND col_info table='%s' current schema='%s'\n", PRINT_NAME(table_name), curschema);
+               found = TRUE;
+               STR_TO_NAME(*schema_name, curschema);
+               break;
            }
        }
-       if (!found && NAME_IS_VALID(*schema_name))
+       if (!found)
        {
-           for (colidx = 0; colidx < conn->ntables; colidx++)
+           QResultClass    *res;
+           char        token[256];
+           BOOL        tblFound = FALSE;
+
+           /*
+            * We also have to check as follows.
+            */
+           snprintf(token, sizeof(token),
+                    "select nspname from pg_namespace n, pg_class c"
+                    " where c.relnamespace=n.oid and c.oid='\"%s\"'::regclass",
+                    SAFE_NAME(table_name));
+           res = CC_send_query(conn, token, NULL, ROLLBACK_ON_ERROR | IGNORE_ABORT_ON_CONN, NULL);
+           if (QR_command_maybe_successful(res))
            {
-               if (!NAMEICMP(conn->col_info[colidx]->table_name, table_name) &&
-                   !NAMEICMP(conn->col_info[colidx]->schema_name, *schema_name))
+               if (QR_get_num_total_tuples(res) == 1)
                {
-                   mylog("FOUND col_info table='%s' schema='%s'\n", PRINT_NAME(table_name), PRINT_NAME(*schema_name));
-                   found = TRUE;
-                   break;
+                   tblFound = TRUE;
+                   STR_TO_NAME(*schema_name, QR_get_value_backend_text(res, 0, 0));
                }
            }
+           QR_Destructor(res);
+           if (!tblFound)
+               return FALSE;
        }
    }
-   else
+   if (!found && NAME_IS_VALID(*schema_name))
    {
        for (colidx = 0; colidx < conn->ntables; colidx++)
        {
-           if (!NAMEICMP(conn->col_info[colidx]->table_name, table_name))
+           if (!NAMEICMP(conn->col_info[colidx]->table_name, table_name) &&
+               !NAMEICMP(conn->col_info[colidx]->schema_name, *schema_name))
            {
-               mylog("FOUND col_info table='%s'\n", table_name);
+               mylog("FOUND col_info table='%s' schema='%s'\n", PRINT_NAME(table_name), PRINT_NAME(*schema_name));
                found = TRUE;
                break;
            }
index 4ce7636b69d371d9f511d492c68013f070e3b32a..b68b9bb1f75bb9dfe50513b65bcd68978e5c3f94 100644 (file)
--- a/pgtypes.c
+++ b/pgtypes.c
@@ -285,12 +285,8 @@ getCharColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod, int adt
 #endif /* UNICODE_SUPPORT */
 
    if (maxsize == TEXT_FIELD_SIZE + 1) /* magic length for testing */
-   {
-       if (PG_VERSION_GE(conn, 7.1))
-           maxsize = 0;
-       else
-           maxsize = TEXT_FIELD_SIZE;
-   }
+       maxsize = 0;
+
    /*
     * Static ColumnSize (i.e., the Maximum ColumnSize of the datatype) This
     * has nothing to do with a result set.
@@ -420,14 +416,9 @@ static SQLSMALLINT
 getTimestampDecimalDigitsX(const ConnectionClass *conn, OID type, int atttypmod)
 {
    mylog("%s: type=%d, atttypmod=%d\n", __FUNCTION__, type, atttypmod);
-
-   if (PG_VERSION_LT(conn, 7.2))
-       return 0;
-
    return (atttypmod > -1 ? atttypmod : 6);
 }
 
-
 static SQLSMALLINT
 getTimestampColumnSizeX(const ConnectionClass *conn, OID type, int atttypmod)
 {
@@ -859,12 +850,7 @@ inolog("pgtype_to_name int4\n");
        case PG_TYPE_ABSTIME:
            return "abstime";
        case PG_TYPE_DATETIME:
-           if (PG_VERSION_GT(conn, 7.1))
-               return "timestamptz";
-           else if (PG_VERSION_LT(conn, 7.0))
-               return "datetime";
-           else
-               return "timestamp";
+           return "timestamptz";
        case PG_TYPE_TIMESTAMP_NO_TMZONE:
            return "timestamp without time zone";
        case PG_TYPE_TIMESTAMP:
@@ -943,12 +929,7 @@ pgtype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, in
                    value = NAME_FIELD_SIZE;
 #endif /* NAME_FIELD_SIZE */
                if (0 == value)
-               {
-                   if (PG_VERSION_GE(conn, 7.3))
-                       value = NAMEDATALEN_V73;
-                   else
-                       value = NAMEDATALEN_V72;
-               }
+                   value = NAMEDATALEN_V73;
                return value;
            }
 
@@ -1152,9 +1133,7 @@ pgtype_attr_buffer_length(const ConnectionClass *conn, OID type, int atttypmod,
            if (CC_is_in_unicode_driver(conn))
                return prec * WCLEN;
 #endif /* UNICODE_SUPPORT */
-           /* after 7.2 */
-           if (PG_VERSION_GE(conn, 7.2))
-               coef = conn->mb_maxbyte_per_char;
+           coef = conn->mb_maxbyte_per_char;
            if (coef < 2 && (conn->connInfo).lf_conversion)
                /* CR -> CR/LF */
                coef = 2;
@@ -1288,9 +1267,7 @@ pgtype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, int att
            if (CC_is_in_unicode_driver(conn))
                return column_size * WCLEN;
 #endif /* UNICODE_SUPPORT */
-           /* after 7.2 */
-           if (PG_VERSION_GE(conn, 7.2))
-               coef = conn->mb_maxbyte_per_char;
+           coef = conn->mb_maxbyte_per_char;
            if (coef < 2 && (conn->connInfo).lf_conversion)
                /* CR -> CR/LF */
                coef = 2;
@@ -1666,12 +1643,8 @@ getCharColumnSize(const StatementClass *stmt, OID type, int col, int handle_unkn
 #endif /* UNICODE_SUPPORT */
 
    if (maxsize == TEXT_FIELD_SIZE + 1) /* magic length for testing */
-   {
-       if (PG_VERSION_GE(conn, 7.1))
-           maxsize = 0;
-       else
-           maxsize = TEXT_FIELD_SIZE;
-   }
+       maxsize = 0;
+
    /*
     * Static ColumnSize (i.e., the Maximum ColumnSize of the datatype) This
     * has nothing to do with a result set.
@@ -1757,8 +1730,6 @@ getTimestampDecimalDigits(const StatementClass *stmt, OID type, int col)
 
    if (col < 0)
        return 0;
-   if (PG_VERSION_LT(conn, 7.2))
-       return 0;
 
    result = SC_get_Curres(stmt);
 
@@ -1886,9 +1857,7 @@ pgtype_transfer_octet_length(const StatementClass *stmt, OID type, int column_si
            if (CC_is_in_unicode_driver(conn))
                return column_size * WCLEN;
 #endif /* UNICODE_SUPPORT */
-           /* after 7.2 */
-           if (PG_VERSION_GE(conn, 7.2))
-               coef = conn->mb_maxbyte_per_char;
+           coef = conn->mb_maxbyte_per_char;
            if (coef < 2 && (conn->connInfo).lf_conversion)
                /* CR -> CR/LF */
                coef = 2;
index a98358f0435ba9257861d767cd004b918d83ec06..6445f3b70d26f1256c92a412c5a788539c7616c7 100644 (file)
@@ -117,7 +117,6 @@ void    copy_globals(GLOBAL_VALUES *to, const GLOBAL_VALUES *from)
    CORR_VALCPY(debug);
    CORR_VALCPY(commlog);
    CORR_VALCPY(disable_optimizer);
-   CORR_VALCPY(ksqo);
    CORR_VALCPY(unique_index);
    CORR_VALCPY(onlyread);      /* readonly is reserved on Digital C++
                                 * compiler */
index 05dcc9e45d092b6df0dbfa1cc8b666bf78fea4e1..602187c17aa086af18e7f5a1deca8567378a2397 100644 (file)
@@ -370,14 +370,6 @@ BOOL isSqlServr(void);
 #endif /* _MAX_PATH */
 #endif /* PATH_MAX */
 
-#define PG62                       "6.2"       /* "Protocol" key setting
-                                                * to force Postgres 6.2 */
-#define PG63                       "6.3"       /* "Protocol" key setting
-                                                * to force postgres 6.3 */
-#define PG64                       "6.4"
-#define PG74REJECTED                   "reject7.4"
-#define PG74                       "7.4"
-
 typedef struct ConnectionClass_ ConnectionClass;
 typedef struct StatementClass_ StatementClass;
 typedef struct QResultClass_ QResultClass;
@@ -478,7 +470,6 @@ typedef struct GlobalValues_
    char        debug;
    char        commlog;
    char        disable_optimizer;
-   char        ksqo;
    char        unique_index;
    char        onlyread;       /* readonly is reserved on Digital C++
                                 * compiler */
index a9de7ec401edf90c76db3b2a8d0b43a0b4701c50..58e8ee9116c88ffa5fc9b9949e573c1e09672024 100644 (file)
@@ -94,8 +94,6 @@ BEGIN
                     BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,26,140,10
     CONTROL         "\88ê\94Ê\83\8d\83O\8fo\97Í\82ð\82·\82é(&L) (C:\\psqlodbc.log)",DRV_COMMLOG,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,167,24,170,10
-    CONTROL         "&KSQO (¸´Ø°·°¾¯Ä\8dÅ\93K\89»\83I\83v\83V\83\87\83\93)",DRV_KSQO,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,15,41,145,10
     CONTROL         "\83\86\83j\81|\83N\83C\83\93\83f\83b\83N\83X\82ð\8eg\82¤(&I)",DRV_UNIQUEINDEX,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,15,56,129,10
     CONTROL         "\83X\83e\81|\83g\83\81\83\93\83g\82Ì\8d\\95\89ð\90Í\82ð\8ds\82È\82¤(&a)",DRV_PARSE,"Button",
@@ -181,15 +179,6 @@ BEGIN
                     WS_TABSTOP,227,108,29,10
     LTEXT           "\93Á\95Ê\82È\83I\83v\83V\83\87\83\93",IDC_STATIC,227,158,66,8
     EDITTEXT        DS_EXTRA_OPTIONS,227,168,35,14,ES_AUTOHSCROLL
-    GROUPBOX        "\83v\83\8d\83g\83R\83\8b\83o\81|\83W\83\87\83\93",IDC_STATIC,5,128,150,25
-    CONTROL         "7.4+",DS_PG74,"Button",BS_AUTORADIOBUTTON | WS_GROUP,18,
-                    139,30,10
-    CONTROL         "6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    52,139,30,10
-    CONTROL         "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    90,140,26,10
-    CONTROL         "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    118,140,26,10
     GROUPBOX        "\83G\83\89\81[\8e\9e\82Ì\83\8d\81[\83\8b\83o\83b\83N\94­\8ds",IDC_STATIC,160,128,130,25
     CONTROL         "\96³\82µ",DS_NO_ROLLBACK,"Button",BS_AUTORADIOBUTTON | 
                     WS_GROUP,165,139,30,10
@@ -559,8 +548,6 @@ BEGIN
                     BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,26,116,10
     CONTROL         "Comm&Log (C:\\psqlodbc_xxxx.log)",DRV_COMMLOG,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,149,26,131,10
-    CONTROL         "&KSQO(Keyset Query Optimization)",DRV_KSQO,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,15,41,132,10
     CONTROL         "Recognize Unique &Indexes",DRV_UNIQUEINDEX,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,15,56,110,10
     CONTROL         "P&arse Statements",DRV_PARSE,"Button",BS_AUTOCHECKBOX | 
@@ -651,15 +638,6 @@ BEGIN
                     WS_TABSTOP,227,107,29,10
     LTEXT     "Extra Opts",IDC_STATIC,264,98,40,17
     EDITTEXT       DS_EXTRA_OPTIONS,264,105,40,12,ES_AUTOHSCROLL
-    GROUPBOX        "Protocol",IDC_STATIC,5,126,136,25
-    CONTROL         "7.4+",DS_PG74,"Button",BS_AUTORADIOBUTTON | WS_GROUP,11,
-                    138,31,10
-    CONTROL         "6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    45,138,27,10
-    CONTROL         "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    79,138,26,10
-    CONTROL         "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    110,138,26,10
     GROUPBOX        "OID Options",IDC_STATIC,5,157,296,25
     CONTROL         "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX | 
                     WS_GROUP | WS_TABSTOP,13,168,67,10
index 6e31bb7aa098ec76adbd8772a50bbe792fbca6a4..50e4c32a3b420dcae2b4a9b3868140801cbc811e 100644 (file)
--- a/qresult.c
+++ b/qresult.c
@@ -33,12 +33,10 @@ static char QR_read_a_tuple_from_db(QResultClass *, char);
 void
 QR_set_num_fields(QResultClass *self, int new_num_fields)
 {
-   BOOL    allocrelatt = FALSE;
-
    if (!self)  return;
    mylog("in QR_set_num_fields\n");
 
-   CI_set_num_fields(QR_get_fields(self), new_num_fields, allocrelatt);
+   CI_set_num_fields(QR_get_fields(self), new_num_fields);
 
    mylog("exit QR_set_num_fields\n");
 }
@@ -1201,9 +1199,7 @@ inolog("clear obsolete %d tuples\n", num_backend_rows);
 
        if (enlargeKeyCache(self, self->cache_size - num_backend_rows, "Out of memory while reading tuples") < 0)
            RETURN(FALSE)
-       if (PROTOCOL_74(ci)
-           && !QR_is_permanent(self) /* Execute seems an invalid operation after COMMIT */
-           )
+       if (!QR_is_permanent(self)) /* Execute seems an invalid operation after COMMIT */
        {
            ExecuteRequest = TRUE;
            if (!SendExecuteRequest(stmt, QR_get_cursor(self),
@@ -1353,8 +1349,7 @@ inolog("id='%c' response_length=%d\n", id, response_length);
                    /* We are done because we didn't even get CACHE_SIZE tuples */
                    mylog("%s: backend_rows < CACHE_SIZE: brows = %d, cache_size = %d\n", func, num_backend_rows, self->cache_size);
                }
-               if (!internally_invoked ||
-                   PG_VERSION_LE(conn, 6.3))
+               if (!internally_invoked)
                    loopend = rcvend = TRUE;
                break;
 
@@ -1364,8 +1359,7 @@ inolog("id='%c' response_length=%d\n", id, response_length);
                mylog("ERROR from backend in next_tuple: '%s'\n", msgbuffer);
                qlog("ERROR from backend in next_tuple: '%s'\n", msgbuffer);
 
-               if (!internally_invoked ||
-                   PG_VERSION_LE(conn, 6.3))
+               if (!internally_invoked)
                    loopend = rcvend = TRUE;
                ret = FALSE;
                break;
@@ -1405,33 +1399,28 @@ inolog("id='%c' response_length=%d\n", id, response_length);
    }
    if (!kill_conn && !rcvend && 0 == SOCK_get_errcode(sock))
    {
-       if (PROTOCOL_74(ci))
+       for (;;) /* discard the result until ReadyForQuery comes */
        {
-           for (;;) /* discard the result until ReadyForQuery comes */
+           id = SOCK_get_id(sock);
+           if (0 != SOCK_get_errcode(sock))
+               break;
+           if (NULL != LastMessageType)
+               *LastMessageType = id;
+           response_length = SOCK_get_response_length(sock);
+           if (0 != SOCK_get_errcode(sock))
+               break;
+           if ('Z' == id) /* ready for query */
            {
-               id = SOCK_get_id(sock);
-               if (0 != SOCK_get_errcode(sock))
-                   break;
-               if (NULL != LastMessageType)
-                   *LastMessageType = id;
-               response_length = SOCK_get_response_length(sock);
-               if (0 != SOCK_get_errcode(sock))
-                   break;
-               if ('Z' == id) /* ready for query */
+               EatReadyForQuery(conn);
+               qlog("%s discarded data until ReadyForQuery comes\n", __FUNCTION__);
+               if (QR_is_fetching_tuples(self))
                {
-                   EatReadyForQuery(conn);
-                   qlog("%s discarded data until ReadyForQuery comes\n", __FUNCTION__);
-                   if (QR_is_fetching_tuples(self))
-                   {
-                       reached_eof_now = TRUE;
-                       QR_set_no_fetching_tuples(self);
-                   }
-                   break;
+                   reached_eof_now = TRUE;
+                   QR_set_no_fetching_tuples(self);
                }
+               break;
            }
        }
-       else
-           kill_conn = TRUE;
    }
    if (0 != SOCK_get_errcode(sock))
    {
@@ -1588,11 +1577,6 @@ QR_read_a_tuple_from_db(QResultClass *self, char binary)
    Int2        field_lf;
    TupleField *this_tuplefield;
    KeySet  *this_keyset = NULL;
-   char        bmp = 0,
-               bitmap[MAX_FIELDS];     /* Max. len of the bitmap */
-   Int2        bitmaplen;      /* len of the bitmap in bytes */
-   Int2        bitmap_pos;
-   Int2        bitcnt;
    Int4        len;
    char       *buffer;
    int     ci_num_fields = QR_NumResultCols(self); /* speed up access */
@@ -1601,7 +1585,6 @@ QR_read_a_tuple_from_db(QResultClass *self, char binary)
    ColumnInfoClass *flds;
    int     effective_cols;
    char        tidoidbuf[32];
-   ConnInfo    *ci = &(QR_get_conn(self)->connInfo);
 
    /* set the current row to read the fields into */
    effective_cols = QR_NumPublicResultCols(self);
@@ -1617,7 +1600,6 @@ QR_read_a_tuple_from_db(QResultClass *self, char binary)
     * At first the server sends a bitmap that indicates which database
     * fields are null
     */
-   if (PROTOCOL_74(ci))
    {
        int numf = SOCK_get_int(sock, sizeof(Int2));
 if (effective_cols > 0)
@@ -1625,18 +1607,6 @@ if (effective_cols > 0)
 else
 {inolog("%dth record in key numf=%d\n", self->num_cached_keys, numf);}
    }
-   else
-   {
-       bitmaplen = (Int2) ci_num_fields / BYTELEN;
-       if ((ci_num_fields % BYTELEN) > 0)
-           bitmaplen++;
-
-       SOCK_get_n_char(sock, bitmap, bitmaplen);
-
-       bitmap_pos = 0;
-       bitcnt = 0;
-       bmp = bitmap[bitmap_pos];
-   }
 
    flds = QR_get_fields(self);
 
@@ -1644,45 +1614,12 @@ else
    {
        BOOL isnull = FALSE;
 
-       if (!PROTOCOL_74(ci))
-       {
-           isnull = ((bmp & 0200) == 0);
-           /* move to next bit in the bitmap */
-           bitcnt++;
-           if (BYTELEN == bitcnt)
-           {
-               bitmap_pos++;
-               bmp = bitmap[bitmap_pos];
-               bitcnt = 0;
-           }
-           else
-               bmp <<= 1;
-
-           if (!isnull)
-           {
-               /* get the length of the field (four bytes) */
-               len = SOCK_get_int(sock, sizeof(Int4));
-
-               /*
-                * In the old protocol version, the length
-                * field of an AsciiRow message includes the
-                * 4-byte length field itself, while the
-                * length field in the BinaryRow does not.
-                */
-               if (!binary)
-                   len -= sizeof(Int4);
-           }
-       }
-       else
-       {
-           /* get the length of the field (four bytes) */
-           len = SOCK_get_int(sock, sizeof(Int4));
-
-           /* -1 means NULL */
-           if (len < 0)
-               isnull = TRUE;
+       /* get the length of the field (four bytes) */
+       len = SOCK_get_int(sock, sizeof(Int4));
 
-       }
+       /* -1 means NULL */
+       if (len < 0)
+           isnull = TRUE;
 
        if (isnull)
        {
index 0060aa20c08c3292e64a33d193bf209a0b01e01e..65c0f361fdc320ee4c4822be0d7d04277daf3683 100644 (file)
@@ -41,7 +41,6 @@
 #define DS_SHOWOIDCOLUMN                1012
 #define DS_FAKEOIDINDEX                 1013
 #define DRV_COMMLOG                     1014
-#define DS_PG62                         1016
 #define IDC_DATASOURCE                  1018
 #define DRV_OPTIMIZER                   1019
 #define DS_CONNSETTINGS                 1020
@@ -68,9 +67,6 @@
 #define DRV_PARSE                       1052
 #define DRV_CANCELASFREESTMT            1053
 #define IDC_OPTIONS                     1054
-#define DRV_KSQO                        1055
-#define DS_PG64                         1057
-#define DS_PG63                         1058
 #define DRV_OR_DSN                      1059
 #define DRV_DEBUG                       1060
 #define DS_DISALLOWPREMATURE            1061
@@ -92,7 +88,6 @@
 #define IDC_DRIVERNAME                  1076
 #define IDC_MANAGEDSN                   1077
 #define IDC_DRIVER_LIST                 1078
-#define DS_PG74                1079
 #define DS_NO_ROLLBACK         1080
 #define DS_TRANSACTION_ROLLBACK        1081
 #define DS_STATEMENT_ROLLBACK      1082
index 83b7c76c5dec54370f88b9598bb2d87fbba1cb7f..e57603b0dbe71386e1e2e48638798e866e76583c 100644 (file)
--- a/results.c
+++ b/results.c
@@ -309,7 +309,7 @@ inolog("answering bookmark info\n");
         * (i.e., because it was a function or expression, etc, then do it the
         * old fashioned way.
         */
-       BOOL    build_fi = PROTOCOL_74(ci) && (NULL != pfNullable || NULL != pfSqlType);
+       BOOL    build_fi = (NULL != pfNullable || NULL != pfSqlType);
        fi = NULL;
        if (!SC_pre_execute_ok(stmt, build_fi, icol, func))
        {
@@ -563,27 +563,24 @@ inolog("answering bookmark info\n");
        BOOL    build_fi = FALSE;
 
        fi = NULL;
-       if (PROTOCOL_74(ci))
+       switch (fDescType)
        {
-           switch (fDescType)
-           {
-               case SQL_COLUMN_OWNER_NAME:
-               case SQL_COLUMN_TABLE_NAME:
-               case SQL_COLUMN_TYPE:
-               case SQL_COLUMN_TYPE_NAME:
-               case SQL_COLUMN_AUTO_INCREMENT:
+           case SQL_COLUMN_OWNER_NAME:
+           case SQL_COLUMN_TABLE_NAME:
+           case SQL_COLUMN_TYPE:
+           case SQL_COLUMN_TYPE_NAME:
+           case SQL_COLUMN_AUTO_INCREMENT:
 #if (ODBCVER >= 0x0300)
-               case SQL_DESC_NULLABLE:
-               case SQL_DESC_BASE_TABLE_NAME:
-               case SQL_DESC_BASE_COLUMN_NAME:
+           case SQL_DESC_NULLABLE:
+           case SQL_DESC_BASE_TABLE_NAME:
+           case SQL_DESC_BASE_COLUMN_NAME:
 #else
-               case SQL_COLUMN_NULLABLE:
+           case SQL_COLUMN_NULLABLE:
 #endif /* ODBCVER */
-               case SQL_COLUMN_UPDATABLE:
-               case 1212: /* SQL_CA_SS_COLUMN_KEY ? */
-                   build_fi = TRUE;
-                   break;
-           }
+           case SQL_COLUMN_UPDATABLE:
+           case 1212: /* SQL_CA_SS_COLUMN_KEY ? */
+               build_fi = TRUE;
+               break;
        }
        if (!SC_pre_execute_ok(stmt, build_fi, col_idx, func))
            return SQL_ERROR;
@@ -765,7 +762,7 @@ inolog("COLUMN_SCALE=%d\n", value);
            if (!stmt_updatable)
                value = SQL_ATTR_READONLY;
            else
-               value = fi ? (fi->updatable ? SQL_ATTR_WRITE : SQL_ATTR_READONLY) : (QR_get_attid(res, col_idx) > 0 ? SQL_ATTR_WRITE : (PROTOCOL_74(ci) ? SQL_ATTR_READONLY : SQL_ATTR_READWRITE_UNKNOWN));
+               value = fi ? (fi->updatable ? SQL_ATTR_WRITE : SQL_ATTR_READONLY) : (QR_get_attid(res, col_idx) > 0 ? SQL_ATTR_WRITE : SQL_ATTR_READONLY);
            if (SQL_ATTR_READONLY != value)
            {
                const char *name = fi ? SAFE_NAME(fi->column_name) : QR_get_fieldname(res, col_idx);
@@ -3060,7 +3057,6 @@ static SQLLEN LoadFromKeyset(StatementClass *stmt, QResultClass * res, int rows_
    ConnectionClass *conn = SC_get_conn(stmt);
    SQLLEN  i;
    int j, rowc, rcnt = 0;
-   BOOL    prepare;
    OID oid;
    UInt4   blocknum;
    SQLLEN  kres_ridx;
@@ -3068,7 +3064,6 @@ static SQLLEN LoadFromKeyset(StatementClass *stmt, QResultClass * res, int rows_
    char    *qval = NULL, *sval = NULL;
    int keys_per_fetch = 10;
 
-   prepare = PG_VERSION_GE(conn, 7.3);
    for (i = SC_get_rowset_start(stmt), kres_ridx = GIdx2KResIdx(i, stmt, res), rowc = 0;; i++)
    {
        if (i >= limitrow)
@@ -3146,73 +3141,65 @@ static SQLLEN LoadFromKeyset(StatementClass *stmt, QResultClass * res, int rows_
            {
                size_t  allen;
 
-               if (prepare)
+               if (res->reload_count > 0)
+                   keys_per_fetch = res->reload_count;
+               else
                {
-                   if (res->reload_count > 0)
-                       keys_per_fetch = res->reload_count;
+                   char    planname[32];
+                   int j;
+                   QResultClass    *qres;
+
+                   if (rows_per_fetch >= pre_fetch_count * 2)
+                       keys_per_fetch = pre_fetch_count;
                    else
+                       keys_per_fetch = rows_per_fetch;
+                   if (!keys_per_fetch)
+                       keys_per_fetch = 2;
+                   lodlen = strlen(stmt->load_statement);
+                   sprintf(planname, "_KEYSET_%p", res);
+                   allen = 8 + strlen(planname) +
+                       3 + 4 * keys_per_fetch + 1
+                       + 1 + 2 + lodlen + 20 +
+                       4 * keys_per_fetch + 1;
+                   SC_MALLOC_return_with_error(qval, char, allen,
+                       stmt, "Couldn't alloc qval", -1);
+                   sprintf(qval, "PREPARE \"%s\"", planname);
+                   sval = strchr(qval, '\0');
+                   for (j = 0; j < keys_per_fetch; j++)
                    {
-                       char    planname[32];
-                       int j;
-                       QResultClass    *qres;
-
-                       if (rows_per_fetch >= pre_fetch_count * 2)
-                           keys_per_fetch = pre_fetch_count;
+                       if (j == 0)
+                           strcpy(sval, "(tid");
                        else
-                           keys_per_fetch = rows_per_fetch;
-                       if (!keys_per_fetch)
-                           keys_per_fetch = 2;
-                       lodlen = strlen(stmt->load_statement);
-                       sprintf(planname, "_KEYSET_%p", res);
-                       allen = 8 + strlen(planname) +
-                           3 + 4 * keys_per_fetch + 1
-                           + 1 + 2 + lodlen + 20 +
-                           4 * keys_per_fetch + 1;
-                       SC_MALLOC_return_with_error(qval, char, allen,
-                           stmt, "Couldn't alloc qval", -1);
-                       sprintf(qval, "PREPARE \"%s\"", planname);
-                       sval = strchr(qval, '\0');
-                       for (j = 0; j < keys_per_fetch; j++)
-                       {
-                           if (j == 0)
-                               strcpy(sval, "(tid");
-                           else
-                               strcpy(sval, ",tid");
-                           sval = strchr(sval, '\0');
-                       }
-                       sprintf(sval, ") as %s where ctid in ", stmt->load_statement);
+                           strcpy(sval, ",tid");
                        sval = strchr(sval, '\0');
-                       for (j = 0; j < keys_per_fetch; j++)
-                       {
-                           if (j == 0)
-                               strcpy(sval, "($1");
-                           else
-                               sprintf(sval, ",$%d", j + 1);
-                           sval = strchr(sval, '\0');
-                       }
-                       strcpy(sval, ")");
-                       qres = CC_send_query(conn, qval, NULL, 0, stmt);
-                       if (QR_command_maybe_successful(qres))
-                       {
-                           res->reload_count = keys_per_fetch;
-                       }
+                   }
+                   sprintf(sval, ") as %s where ctid in ", stmt->load_statement);
+                   sval = strchr(sval, '\0');
+                   for (j = 0; j < keys_per_fetch; j++)
+                   {
+                       if (j == 0)
+                           strcpy(sval, "($1");
                        else
-                       {
-                           SC_set_error(stmt, STMT_EXEC_ERROR, "Prepare for Data Load Error", func);
-                           rcnt = -1;
-                           QR_Destructor(qres);
-                           break;
-                       }
+                           sprintf(sval, ",$%d", j + 1);
+                       sval = strchr(sval, '\0');
+                   }
+                   strcpy(sval, ")");
+                   qres = CC_send_query(conn, qval, NULL, 0, stmt);
+                   if (QR_command_maybe_successful(qres))
+                   {
+                       res->reload_count = keys_per_fetch;
+                   }
+                   else
+                   {
+                       SC_set_error(stmt, STMT_EXEC_ERROR, "Prepare for Data Load Error", func);
+                       rcnt = -1;
                        QR_Destructor(qres);
+                       break;
                    }
-                   allen = 25 + 23 * keys_per_fetch;
-               }
-               else
-               {
-                   keys_per_fetch = pre_fetch_count;
-                   lodlen = strlen(stmt->load_statement);
-                   allen = lodlen + 20 + 23 * keys_per_fetch;
+                   QR_Destructor(qres);
                }
+               allen = 25 + 23 * keys_per_fetch;
+
                SC_REALLOC_return_with_error(qval, char, allen,
                    stmt, "Couldn't alloc qval", -1);
            }
@@ -3912,23 +3899,20 @@ irow_insert(RETCODE ret, StatementClass *stmt, StatementClass *istmt,
            sscanf(cmdstr, "INSERT %u %d", &oid, &addcnt) == 2 &&
            addcnt == 1)
        {
-           ConnectionClass *conn = SC_get_conn(stmt);
            RETCODE qret;
+           const char * tidval = NULL;
 
            if (0 != oid)
                poid = &oid;
            qret = SQL_NO_DATA_FOUND;
-           if (PG_VERSION_GE(conn, 7.2))
-           {
-               const char * tidval = NULL;
 
-               if (NULL != tres->backend_tuples &&
-                   1 == QR_get_num_cached_tuples(tres))
-                   tidval = QR_get_value_backend_text(tres, 0, 0);
-               qret = SC_pos_newload(stmt, poid, TRUE, tidval);
-               if (SQL_ERROR == qret)
-                   return qret;
-           }
+           if (NULL != tres->backend_tuples &&
+               1 == QR_get_num_cached_tuples(tres))
+               tidval = QR_get_value_backend_text(tres, 0, 0);
+           qret = SC_pos_newload(stmt, poid, TRUE, tidval);
+           if (SQL_ERROR == qret)
+               return qret;
+
            if (SQL_NO_DATA_FOUND == qret)
            {
                qret = SC_pos_newload(stmt, poid, FALSE, NULL);
index a2034d20910f7c51dd8a37689168b76ce15a3b81..5b51b85e11778785b1b3bb23e96579dad8b762cd 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -128,7 +128,6 @@ SOCK_Constructor(const ConnectionClass *conn)
        }
        rv->_errormsg_ = NULL;
        rv->errornumber = 0;
-       rv->reverse = FALSE;
    }
    return rv;
 }
@@ -159,8 +158,7 @@ SOCK_Destructor(SocketClass *self)
        if (self->socket != (SOCKETFD) -1)
        {
            SOCK_put_char(self, 'X');
-           if (PG_PROTOCOL_74 == self->pversion)
-               SOCK_put_int(self, 4, 4);
+           SOCK_put_int(self, 4, 4);
            SOCK_flush_output(self);
            closesocket(self->socket);
        }
@@ -888,9 +886,6 @@ SOCK_put_string(SocketClass *self, const char *string)
    }
 }
 
-#define    REVERSE_SHORT(val)  ((val & 0xff) << 8) | (val >> 8)
-#define    REVERSE_INT(val) ((val & 0xff) << 24) | ((val & 0xff00) << 8) | ((val & 0xff0000) >> 8) | (val >> 24)
-
 int
 SOCK_get_int(SocketClass *self, short len)
 {
@@ -903,10 +898,7 @@ SOCK_get_int(SocketClass *self, short len)
                unsigned short buf;
 
                SOCK_get_n_char(self, (char *) &buf, len);
-               if (self->reverse)
-                   return REVERSE_SHORT(ntohs(buf));
-               else
-                   return ntohs(buf);
+               return ntohs(buf);
            }
 
        case 4:
@@ -914,10 +906,7 @@ SOCK_get_int(SocketClass *self, short len)
                unsigned int buf;
 
                SOCK_get_n_char(self, (char *) &buf, len);
-               if (self->reverse)
-                   return REVERSE_INT(htonl(buf));
-               else
-                   return ntohl(buf);
+               return ntohl(buf);
            }
 
        default:
@@ -939,15 +928,11 @@ SOCK_put_int(SocketClass *self, int value, short len)
    {
        case 2:
            rsv = htons((unsigned short) value);
-           if (self->reverse)
-               rsv = REVERSE_SHORT(rsv);
            SOCK_put_n_char(self, (char *) &rsv, 2);
            return;
 
        case 4:
            rv = htonl((unsigned int) value);
-           if (self->reverse)
-               rv = REVERSE_INT(rv);
            SOCK_put_n_char(self, (char *) &rv, 4);
            return;
 
@@ -1082,8 +1067,7 @@ inolog("ECONNRESET\n");
    }
    if (peek)
        return self->buffer_in[self->buffer_read_in];
-   if (PG_PROTOCOL_74 == self->pversion)
-       self->reslen--;
+   self->reslen--;
    return self->buffer_in[self->buffer_read_in++];
 }
 
@@ -1173,8 +1157,7 @@ inolog("ECONNRESET\n");
    if (buf)
        memcpy(buf + n - rest, self->buffer_in + self->buffer_read_in, rlen);
    rest -= rlen;
-   if (PG_PROTOCOL_74 == self->pversion)
-       self->reslen -= rlen;
+   self->reslen -= rlen;
    self->buffer_read_in += rlen;
    }
 
@@ -1237,11 +1220,8 @@ SOCK_get_response_length(SocketClass *self)
 {
    int     leng = -1;
 
-   if (PG_PROTOCOL_74 == self->pversion)
-   {
-       leng = SOCK_get_int(self, 4) - 4;
-       self->reslen = leng;
-   }
+   leng = SOCK_get_int(self, 4) - 4;
+   self->reslen = leng;
 
    return leng;
 }
index dc68e63eebdbbc40954e313472f6bc2de84dc3a9..66ae1de92ed5e34164807e33189daf09d697c2ca 100644 (file)
--- a/socket.h
+++ b/socket.h
@@ -177,8 +177,6 @@ struct SocketClass_
    gss_name_t  gtarg_nam;  /* GSS target name */
 #endif /* USE_GSS */
 
-   char        reverse;    /* used to handle Postgres 6.2 protocol
-                       * (reverse byte order) */
    char        keepalive;  /* TCP keepalive */
    int     keepalive_idle;
    int     keepalive_interval;
index da5abf53e370a4451200f92cef68ea8c687c3357..599f34d708aef5949fea863a4791cd766c3569fa 100644 (file)
@@ -226,7 +226,6 @@ PGAPI_AllocStmt(HDBC hdbc,
    ardopts = SC_get_ARDF(stmt);
    ARD_AllocBookmark(ardopts);
 
-   stmt->stmt_size_limit = CC_get_max_query_len(conn);
    /* Save the handle for later */
    stmt->phstmt = phstmt;
 
@@ -353,11 +352,6 @@ InitializeStatementOptions(StatementOptions *opt)
 static void SC_clear_parse_status(StatementClass *self, ConnectionClass *conn)
 {
    self->parse_status = STMT_PARSE_NONE;
-   if (PG_VERSION_LT(conn, 7.2))
-   {
-       SC_set_checked_hasoids(self, TRUE);
-       self->num_key_fields = PG_NUM_NORMAL_KEYS;
-   }
 }
 
 static void SC_init_discard_output_params(StatementClass *self)
@@ -414,8 +408,6 @@ SC_Constructor(ConnectionClass *conn)
        rv->statement = NULL;
        rv->stmt_with_params = NULL;
        rv->load_statement = NULL;
-       rv->execute_statement = NULL;
-       rv->stmt_size_limit = -1;
        rv->statement_type = STMT_TYPE_UNKNOWN;
 
        rv->currTuple = -1;
@@ -712,9 +704,9 @@ SC_set_prepared(StatementClass *stmt, int prepared)
 }
 
 /*
- * Initialize stmt_with_params, load_statement and execute_statement
- *     member pointer deallocating corresponding prepared plan.
- * Also initialize statement member pointer if specified.
+ * Initialize stmt_with_params and load_statement member pointer
+ * deallocating corresponding prepared plan. Also initialize
+ * statement member pointer if specified.
  */
 RETCODE
 SC_initialize_stmts(StatementClass *self, BOOL initializeOriginal)
@@ -736,11 +728,6 @@ SC_initialize_stmts(StatementClass *self, BOOL initializeOriginal)
            free(self->statement);
            self->statement = NULL;
        }
-       if (self->execute_statement)
-       {
-           free(self->execute_statement);
-           self->execute_statement = NULL;
-       }
        self->prepare = NON_PREPARE_STATEMENT;
        SC_set_prepared(self, NOT_YET_PREPARED);
        self->statement_type = STMT_TYPE_UNKNOWN; /* unknown */
@@ -1956,13 +1943,7 @@ SC_execute(StatementClass *self)
    if (issue_begin)
    {
        mylog("   about to begin a transaction on statement = %p\n", self);
-       if (PG_VERSION_GE(conn, 7.1))
-           qflag |= GO_INTO_TRANSACTION;
-                else if (!CC_begin(conn))
-                {
-           SC_set_error(self, STMT_EXEC_ERROR, "Could not begin a transaction", func);
-           goto cleanup;
-                }
+       qflag |= GO_INTO_TRANSACTION;
    }
 
    /* self->status = STMT_EXECUTING; */
@@ -1985,8 +1966,7 @@ SC_execute(StatementClass *self)
    {
        case PREPARING_PERMANENTLY:
        case PREPARED_PERMANENTLY:
-           if (PROTOCOL_74(ci))
-               use_extended_protocol = TRUE;
+           use_extended_protocol = TRUE;
            break;
        case PREPARING_TEMPORARILY:
        case PREPARED_TEMPORARILY:
@@ -2203,7 +2183,7 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul
                }
            }
 
-inolog("!!%p->SC_is_concat_pre=%x res=%p\n", self, self->miscinfo, res);
+inolog("!!%p->miscinfo=%x res=%p\n", self, self->miscinfo, res);
            /*
             * special handling of result for keyset driven cursors.
             * Use the columns info of the 1st query and
@@ -2225,19 +2205,6 @@ inolog("!!%p->SC_is_concat_pre=%x res=%p\n", self, self->miscinfo, res);
                    res = tres;
                }
            }
-           /* skip the result of PREPARE in 'PREPARE ..:EXECUTE ..' call */
-           else if (SC_is_concat_prepare_exec(self))
-           {
-               tres = res->next;
-inolog("res->next=%p\n", tres);
-               res->next = NULL;
-               if (res != SC_get_Result(self))
-                   QR_Destructor(res);
-               SC_set_Result(self, tres);
-               res = tres;
-               SC_set_prepared(self, PREPARED_PERMANENTLY);
-               SC_no_concat_prepare_exec(self);
-           }
        }
    }
    else
index 2d1dde3aa939d4f1e2d650c408815e54526728aa..43fd9ba769167d833af221f165d8b9a0bb36433d 100644 (file)
@@ -253,7 +253,6 @@ struct StatementClass_
 
    char        *stmt_with_params;  /* statement after parameter
                             * substitution */
-   Int4        stmt_size_limit; /* PG restriction */
    SQLLEN      exec_start_row;
    SQLLEN      exec_end_row;
    SQLLEN      exec_current_row;
@@ -265,7 +264,6 @@ struct StatementClass_
    po_ind_t    updatable;
    SQLLEN      diag_row_count;
    char        *load_statement; /* to (re)load updatable individual rows */
-   char        *execute_statement; /* to execute the prepared plans */
    Int4        from_pos;
    Int4        where_pos;
    SQLLEN      last_fetch_count_include_ommitted;
@@ -370,7 +368,6 @@ enum {
      NON_PREPARE_STATEMENT = 0
    , PREPARE_STATEMENT = 1
    , PREPARE_BY_THE_DRIVER = (1L << 1)
-   , USING_PREPARE_COMMAND = (2L << 1)
    , NAMED_PARSE_REQUEST = (3L << 1)
    , PARSE_TO_EXEC_ONCE = (4L << 1)
    , PARSE_REQ_FOR_INFO = (5L << 1)
@@ -394,9 +391,6 @@ enum
 #define SC_set_fetchcursor(a)  (a->miscinfo |= (1L << 1))
 #define SC_no_fetchcursor(a)   (a->miscinfo &= ~(1L << 1))
 #define SC_is_fetchcursor(a)   ((a->miscinfo & (1L << 1)) != 0)
-#define SC_set_concat_prepare_exec(a)  (a->miscinfo |= (1L << 2))
-#define SC_no_concat_prepare_exec(a)   (a->miscinfo &= ~(1L << 2))
-#define SC_is_concat_prepare_exec(a)   ((a->miscinfo & (1L << 2)) != 0)
 #define SC_set_with_hold(a)    (a->miscinfo |= (1L << 3))
 #define SC_set_without_hold(a) (a->miscinfo &= ~(1L << 3))
 #define SC_is_with_hold(a) ((a->miscinfo & (1L << 3)) != 0)