Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit da5aba1

Browse files
committed
Remove Ops parameter from STATRELID cache lookup, for Tom Lane and
optimizer.
1 parent 4d564c5 commit da5aba1

File tree

8 files changed

+61
-73
lines changed

8 files changed

+61
-73
lines changed

doc/src/sgml/oper.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ logical union
411411
<ROW>
412412
<ENTRY> !~* </ENTRY>
413413
<ENTRY>Does not match (regex), case insensitive</ENTRY>
414-
<ENTRY>'thomas' !~ '.*vadim.*'</ENTRY>
414+
<ENTRY>'thomas' !~* '.*vadim.*'</ENTRY>
415415
</ROW>
416416
</TBODY>
417417
</TGROUP>

src/backend/catalog/indexing.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.56 2000/01/10 16:13:12 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.57 2000/01/24 02:12:54 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -64,7 +64,7 @@ char *Name_pg_rewrite_indices[Num_pg_rewrite_indices] =
6464
char *Name_pg_shadow_indices[Num_pg_shadow_indices] =
6565
{ShadowNameIndex, ShadowSysidIndex};
6666
char *Name_pg_statistic_indices[Num_pg_statistic_indices] =
67-
{StatisticRelidAttnumOpIndex};
67+
{StatisticRelidAttnumIndex};
6868
char *Name_pg_trigger_indices[Num_pg_trigger_indices] =
6969
{TriggerRelidIndex, TriggerConstrNameIndex, TriggerConstrRelidIndex};
7070
char *Name_pg_type_indices[Num_pg_type_indices] =
@@ -926,13 +926,12 @@ ShadowSysidIndexScan(Relation heapRelation, int4 sysId)
926926

927927

928928
HeapTuple
929-
StatisticRelidAttnumOpIndexScan(Relation heapRelation,
929+
StatisticRelidAttnumIndexScan(Relation heapRelation,
930930
Oid relId,
931-
AttrNumber attNum,
932-
Oid op)
931+
AttrNumber attNum)
933932
{
934933
Relation idesc;
935-
ScanKeyData skey[3];
934+
ScanKeyData skey[2];
936935
HeapTuple tuple;
937936

938937
ScanKeyEntryInitialize(&skey[0],
@@ -947,14 +946,8 @@ StatisticRelidAttnumOpIndexScan(Relation heapRelation,
947946
(RegProcedure) F_INT2EQ,
948947
Int16GetDatum(attNum));
949948

950-
ScanKeyEntryInitialize(&skey[2],
951-
(bits16) 0x0,
952-
(AttrNumber) 3,
953-
(RegProcedure) F_OIDEQ,
954-
ObjectIdGetDatum(op));
955-
956-
idesc = index_openr(StatisticRelidAttnumOpIndex);
957-
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
949+
idesc = index_openr(StatisticRelidAttnumIndex);
950+
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
958951

959952
index_close(idesc);
960953

src/backend/utils/adt/selfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.51 2000/01/23 03:43:23 tgl Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.52 2000/01/24 02:12:55 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -609,7 +609,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid opid, Oid typid,
609609
tuple = SearchSysCacheTuple(STATRELID,
610610
ObjectIdGetDatum(relid),
611611
Int16GetDatum((int16) attnum),
612-
opid,
612+
0,
613613
0);
614614
if (!HeapTupleIsValid(tuple))
615615
{

src/backend/utils/cache/syscache.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.45 2000/01/23 03:43:24 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.46 2000/01/24 02:12:56 momjian Exp $
1111
*
1212
* NOTES
1313
* These routines allow the parser/planner/executor to perform
@@ -54,7 +54,7 @@ typedef HeapTuple (*ScanFunc) ();
5454
Add your new cache to the list in include/utils/syscache.h. Keep
5555
the list sorted alphabetically and adjust the cache numbers
5656
accordingly.
57-
57+
5858
Add your entry to the cacheinfo[] array below. All cache lists are
5959
alphabetical, so add it in the proper place. Specify the relation
6060
name, number of arguments, argument names, size of tuple, index lookup
@@ -75,7 +75,7 @@ typedef HeapTuple (*ScanFunc) ();
7575
Finally, any place your relation gets heap_insert() or
7676
heap_update calls, include code to do a CatalogIndexInsert() to update
7777
the system indexes. The heap_* calls do not update indexes.
78-
78+
7979
bjm 1999/11/22
8080
8181
---------------------------------------------------------------------------
@@ -360,16 +360,16 @@ NULL,NULL
360360
/* ShadowSysidIndex,
361361
ShadowSysidIndexScan*/},
362362
{StatisticRelationName, /* STATRELID */
363-
3,
363+
2,
364364
{
365365
Anum_pg_statistic_starelid,
366366
Anum_pg_statistic_staattnum,
367-
Anum_pg_statistic_staop,
367+
0,
368368
0
369369
},
370370
offsetof(FormData_pg_statistic, stacommonval),
371-
StatisticRelidAttnumOpIndex,
372-
(ScanFunc) StatisticRelidAttnumOpIndexScan},
371+
StatisticRelidAttnumIndex,
372+
(ScanFunc) StatisticRelidAttnumIndexScan},
373373
{TypeRelationName, /* TYPENAME */
374374
1,
375375
{
@@ -520,7 +520,7 @@ SearchSysCacheTuple(int cacheId,/* cache selection code */
520520
get_temp_rel_by_username(DatumGetPointer(key1))) != NULL)
521521
key1 = PointerGetDatum(nontemp_relname);
522522
}
523-
523+
524524
tp = SearchSysCache(SysCache[cacheId], key1, key2, key3, key4);
525525
if (!HeapTupleIsValid(tp))
526526
{

src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
* Copyright (c) 1994, Regents of the University of California
3838
*
39-
* $Id: catversion.h,v 1.9 2000/01/22 23:50:23 tgl Exp $
39+
* $Id: catversion.h,v 1.10 2000/01/24 02:12:57 momjian Exp $
4040
*
4141
*-------------------------------------------------------------------------
4242
*/
@@ -52,6 +52,6 @@
5252
*/
5353

5454
/* yyyymmddN */
55-
#define CATALOG_VERSION_NO 200001221
55+
#define CATALOG_VERSION_NO 200001251
5656

5757
#endif

src/include/catalog/indexing.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: indexing.h,v 1.33 2000/01/10 16:13:20 momjian Exp $
10+
* $Id: indexing.h,v 1.34 2000/01/24 02:12:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -73,7 +73,7 @@
7373
#define RewriteRulenameIndex "pg_rewrite_rulename_index"
7474
#define ShadowNameIndex "pg_shadow_name_index"
7575
#define ShadowSysidIndex "pg_shadow_sysid_index"
76-
#define StatisticRelidAttnumOpIndex "pg_statistic_relid_att_op_index"
76+
#define StatisticRelidAttnumIndex "pg_statistic_relid_att_index"
7777
#define TriggerConstrNameIndex "pg_trigger_tgconstrname_index"
7878
#define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index"
7979
#define TriggerRelidIndex "pg_trigger_tgrelid_index"
@@ -153,8 +153,8 @@ extern HeapTuple RewriteRulenameIndexScan(Relation heapRelation,
153153
char *ruleName);
154154
extern HeapTuple ShadowNameIndexScan(Relation heapRelation, char *useName);
155155
extern HeapTuple ShadowSysidIndexScan(Relation heapRelation, int4 sysId);
156-
extern HeapTuple StatisticRelidAttnumOpIndexScan(Relation heapRelation,
157-
Oid relId, AttrNumber attNum, Oid op);
156+
extern HeapTuple StatisticRelidAttnumIndexScan(Relation heapRelation,
157+
Oid relId, AttrNumber attNum);
158158
extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName);
159159
extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId);
160160

@@ -202,7 +202,7 @@ DECLARE_UNIQUE_INDEX(pg_rewrite_rulename_index on pg_rewrite using btree(rulenam
202202
xDECLARE_UNIQUE_INDEX(pg_shadow_name_index on pg_shadow using btree(usename name_ops));
203203
xDECLARE_UNIQUE_INDEX(pg_shadow_sysid_index on pg_shadow using btree(usesysid int4_ops));
204204
*/
205-
DECLARE_INDEX(pg_statistic_relid_att_op_index on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, staop oid_ops));
205+
DECLARE_INDEX(pg_statistic_relid_att_op_index on pg_statistic using btree(starelid oid_ops, staattnum int2_ops));
206206
DECLARE_INDEX(pg_trigger_tgconstrname_index on pg_trigger using btree(tgconstrname name_ops));
207207
DECLARE_INDEX(pg_trigger_tgconstrrelid_index on pg_trigger using btree(tgconstrrelid oid_ops));
208208
DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops));

src/interfaces/libpq/fe-connect.c

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.114 2000/01/23 01:27:39 petere Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.115 2000/01/24 02:12:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -391,7 +391,6 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
391391
PGconn *conn;
392392
char *tmp; /* An error message from some service we call. */
393393
bool error = FALSE; /* We encountered an error. */
394-
int i;
395394

396395
conn = makeEmptyPGconn();
397396
if (conn == NULL)
@@ -585,6 +584,30 @@ update_db_info(PGconn *conn)
585584
return 0;
586585
}
587586

587+
/* ----------
588+
* connectMakeNonblocking -
589+
* Make a connection non-blocking.
590+
* Returns 1 if successful, 0 if not.
591+
* ----------
592+
*/
593+
static int
594+
connectMakeNonblocking(PGconn *conn)
595+
{
596+
#ifndef WIN32
597+
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
598+
#else
599+
if (ioctlsocket(conn->sock, FIONBIO, &on) != 0)
600+
#endif
601+
{
602+
printfPQExpBuffer(&conn->errorMessage,
603+
"connectMakeNonblocking -- fcntl() failed: errno=%d\n%s\n",
604+
errno, strerror(errno));
605+
return 0;
606+
}
607+
608+
return 1;
609+
}
610+
588611
/* ----------
589612
* connectNoDelay -
590613
* Sets the TCP_NODELAY socket option.
@@ -755,7 +778,7 @@ connectDBStart(PGconn *conn)
755778
* Ewan Mellor <eem21@cam.ac.uk>.
756779
* ---------- */
757780
#if (!defined(WIN32) || defined(WIN32_NON_BLOCKING_CONNECTIONS)) && !defined(USE_SSL)
758-
if (PQsetnonblocking(conn, TRUE) != 0)
781+
if (connectMakeNonblocking(conn) == 0)
759782
goto connect_errReturn;
760783
#endif
761784

@@ -868,7 +891,7 @@ connectDBStart(PGconn *conn)
868891
/* This makes the connection non-blocking, for all those cases which forced us
869892
not to do it above. */
870893
#if (defined(WIN32) && !defined(WIN32_NON_BLOCKING_CONNECTIONS)) || defined(USE_SSL)
871-
if (PQsetnonblocking(conn, TRUE) != 0)
894+
if (connectMakeNonblocking(conn) == 0)
872895
goto connect_errReturn;
873896
#endif
874897

@@ -1786,6 +1809,13 @@ closePGconn(PGconn *conn)
17861809
(void) pqFlush(conn);
17871810
}
17881811

1812+
/*
1813+
* must reset the blocking status so a possible reconnect will work
1814+
* don't call PQsetnonblocking() because it will fail if it's unable
1815+
* to flush the connection.
1816+
*/
1817+
conn->nonblocking = FALSE;
1818+
17891819
/*
17901820
* Close the connection, reset all transient state, flush I/O buffers.
17911821
*/

src/interfaces/libpq/fe-exec.c

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.87 2000/01/18 06:09:24 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.88 2000/01/24 02:12:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2116,7 +2116,6 @@ PQgetisnull(const PGresult *res, int tup_num, int field_num)
21162116
int
21172117
PQsetnonblocking(PGconn *conn, int arg)
21182118
{
2119-
int fcntlarg;
21202119

21212120
arg = (arg == TRUE) ? 1 : 0;
21222121
/* early out if the socket is already in the state requested */
@@ -2131,45 +2130,11 @@ PQsetnonblocking(PGconn *conn, int arg)
21312130
* _from_ or _to_ blocking mode, either way we can block them.
21322131
*/
21332132
/* if we are going from blocking to non-blocking flush here */
2134-
if (!pqIsnonblocking(conn) && pqFlush(conn))
2135-
return (-1);
2136-
2137-
2138-
#ifdef USE_SSL
2139-
if (conn->ssl)
2140-
{
2141-
printfPQExpBuffer(&conn->errorMessage,
2142-
"PQsetnonblocking() -- not supported when using SSL\n");
2143-
return (-1);
2144-
}
2145-
#endif /* USE_SSL */
2146-
2147-
#ifndef WIN32
2148-
fcntlarg = fcntl(conn->sock, F_GETFL, 0);
2149-
if (fcntlarg == -1)
2150-
return (-1);
2151-
2152-
if ((arg == TRUE &&
2153-
fcntl(conn->sock, F_SETFL, fcntlarg | O_NONBLOCK) == -1) ||
2154-
(arg == FALSE &&
2155-
fcntl(conn->sock, F_SETFL, fcntlarg & ~O_NONBLOCK) == -1))
2156-
#else
2157-
fcntlarg = arg;
2158-
if (ioctlsocket(conn->sock, FIONBIO, &fcntlarg) != 0)
2159-
#endif
2160-
{
2161-
printfPQExpBuffer(&conn->errorMessage,
2162-
"PQsetblocking() -- unable to set nonblocking status to %s\n",
2163-
arg == TRUE ? "TRUE" : "FALSE");
2133+
if (pqFlush(conn))
21642134
return (-1);
2165-
}
21662135

21672136
conn->nonblocking = arg;
21682137

2169-
/* if we are going from non-blocking to blocking flush here */
2170-
if (pqIsnonblocking(conn) && pqFlush(conn))
2171-
return (-1);
2172-
21732138
return (0);
21742139
}
21752140

0 commit comments

Comments
 (0)