8000 merge with current postgres HEAD · m99coder/postgres_cluster@3ca1937 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ca1937

Browse files
committed
merge with current postgres HEAD
2 parents 6da2256 + 0f370ad commit 3ca1937

File tree

350 files changed

+12267
-4433
lines changed
  • conversion_procs
  • misc
  • sort
  • time
  • bin
  • include
  • interfaces
  • pl
  • port
  • test
  • tools
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    350 files changed

    +12267
    -4433
    lines changed

    config/programs.m4

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -77,7 +77,7 @@ else
    7777
    echo '%%' > conftest.l
    7878
    if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
    7979
    pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
    80-
    if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 = 2 && [$]2 = 5 && [$]3 >= 31) exit 0; else exit 1;}'
    80+
    if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 = 2 && ([$]2 > 5 || ([$]2 = 5 && [$]3 >= 31))) exit 0; else exit 1;}'
    8181
    then
    8282
    pgac_cv_path_flex=$pgac_candidate
    8383
    break 2

    configure

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -7272,7 +7272,7 @@ else
    72727272
    echo '%%' > conftest.l
    72737273
    if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
    72747274
    pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
    7275-
    if echo "$pgac_flex_version" | sed 's/[.a-z]/ /g' | $AWK '{ if ($1 = 2 && $2 = 5 && $3 >= 31) exit 0; else exit 1;}'
    7275+
    if echo "$pgac_flex_version" | sed 's/[.a-z]/ /g' | $AWK '{ if ($1 = 2 && ($2 > 5 || ($2 = 5 && $3 >= 31))) exit 0; else exit 1;}'
    72767276
    then
    72777277
    pgac_cv_path_flex=$pgac_candidate
    72787278
    break 2

    contrib/hstore/hstore.h

    Lines changed: 5 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -76,11 +76,11 @@ typedef struct
    7676
    #define STRPTR(x) ( (char*)(ARRPTR(x) + HS_COUNT((HStore*)(x)) * 2) )
    7777

    7878
    /* note multiple/non evaluations */
    79-
    #define HS_KEY(arr_,str_,i_) ((str_) + HSE_OFF((arr_)[2*(i_)]))
    80-
    #define HS_VAL(arr_,str_,i_) ((str_) + HSE_OFF((arr_)[2*(i_)+1]))
    81-
    #define HS_KEYLEN(arr_,i_) (HSE_LEN((arr_)[2*(i_)]))
    82-
    #define HS_VALLEN(arr_,i_) (HSE_LEN((arr_)[2*(i_)+1]))
    83-
    #define HS_VALISNULL(arr_,i_) (HSE_ISNULL((arr_)[2*(i_)+1]))
    79+
    #define HSTORE_KEY(arr_,str_,i_) ((str_) + HSE_OFF((arr_)[2*(i_)]))
    80+
    #define HSTORE_VAL(arr_,str_,i_) ((str_) + HSE_OFF((arr_)[2*(i_)+1]))
    81+
    #define HSTORE_KEYLEN(arr_,i_) (HSE_LEN((arr_)[2*(i_)]))
    82+
    #define HSTORE_VALLEN(arr_,i_) (HSE_LEN((arr_)[2*(i_)+1]))
    83+
    #define HSTORE_VALISNULL(arr_,i_) (HSE_ISNULL((arr_)[2*(i_)+1]))
    8484

    8585
    /*
    8686
    * currently, these following macros are the _only_ places that rely

    contrib/hstore/hstore_compat.c

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -149,7 +149,7 @@ hstoreValidNewFormat(HStore *hs)
    149149

    150150
    for (i = 1; i < count; ++i)
    151151
    {
    152-
    if (HS_KEYLEN(entries, i) < HS_KEYLEN(entries, i - 1))
    152+
    if (HSTORE_KEYLEN(entries, i) < HSTORE_KEYLEN(entries, i - 1))
    153153
    return 0;
    154154
    if (HSE_ISNULL(entries[2 * i]))
    155155
    return 0;

    contrib/hstore/hstore_gin.c

    Lines changed: 5 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -59,14 +59,16 @@ gin_extract_hstore(PG_FUNCTION_ARGS)
    5959
    {
    6060
    text *item;
    6161

    62-
    item = makeitem(HS_KEY(hsent, ptr, i), HS_KEYLEN(hsent, i),
    62+
    item = makeitem(HSTORE_KEY(hsent, ptr, i),
    63+
    HSTORE_KEYLEN(hsent, i),
    6364
    KEYFLAG);
    6465
    entries[2 * i] = PointerGetDatum(item);
    6566

    66-
    if (HS_VALISNULL(hsent, i))
    67+
    if (HSTORE_VALISNULL(hsent, i))
    6768
    item = makeitem(NULL, 0, NULLFLAG);
    6869
    else
    69-
    item = makeitem(HS_VAL(hsent, ptr, i), HS_VALLEN(hsent, i),
    70+
    item = makeitem(HSTORE_VAL(hsent, ptr, i),
    71+
    HSTORE_VALLEN(hsent, i),
    7072
    VALFLAG);
    7173
    entries[2 * i + 1] = PointerGetDatum(item);
    7274
    }

    contrib/hstore/hstore_gist.c

    Lines changed: 10 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -129,11 +129,13 @@ ghstore_compress(PG_FUNCTION_ARGS)
    129129
    {
    130130
    int h;
    131131

    132-
    h = crc32_sz((char *) HS_KEY(hsent, ptr, i), HS_KEYLEN(hsent, i));
    132+
    h = crc32_sz((char *) HSTORE_KEY(hsent, ptr, i),
    133+
    HSTORE_KEYLEN(hsent, i));
    133134
    HASH(GETSIGN(res), h);
    134-
    if (!HS_VALISNULL(hsent, i))
    135+
    if (!HSTORE_VALISNULL(hsent, i))
    135136
    {
    136-
    h = crc32_sz((char *) HS_VAL(hsent, ptr, i), HS_VALLEN(hsent, i));
    137+
    h = crc32_sz((char *) HSTORE_VAL(hsent, ptr, i),
    138+
    HSTORE_VALLEN(hsent, i));
    137139
    HASH(GETSIGN(res), h);
    138140
    }
    139141
    }
    @@ -524,13 +526,15 @@ ghstore_consistent(PG_FUNCTION_ARGS)
    524526

    525527
    for (i = 0; res && i < count; ++i)
    526528
    {
    527-
    int crc = crc32_sz((char *) HS_KEY(qe, qv, i), HS_KEYLEN(qe, i));
    529+
    int crc = crc32_sz((char *) HSTORE_KEY(qe, qv, i),
    530+
    HSTORE_KEYLEN(qe, i));
    528531

    529532
    if (GETBIT(sign, HASHVAL(crc)))
    530533
    {
    531-
    if (!HS_VALISNULL(qe, i))
    534+
    if (!HSTORE_VALISNULL(qe, i))
    532535
    {
    533-
    crc = crc32_sz((char *) HS_VAL(qe, qv, i), HS_VALLEN(qe, i));
    536+
    crc = crc32_sz((char *) HSTORE_VAL(qe, qv, i),
    537+
    HSTORE_VALLEN(qe, i));
    534538
    if (!GETBIT(sign, HASHVAL(crc)))
    535539
    res = false;
    536540
    }

    contrib/hstore/hstore_io.c

    Lines changed: 46 additions & 37 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1068,7 +1068,7 @@ hstore_populate_record(PG_FUNCTION_ARGS)
    10681068
    column_info->column_type = column_type;
    10691069
    }
    10701070

    1071-
    if (idx < 0 || HS_VALISNULL(entries, idx))
    1071+
    if (idx < 0 || HSTORE_VALISNULL(entries, idx))
    10721072
    {
    10731073
    /*
    10741074
    * need InputFunctionCall to happen even for nulls, so that domain
    @@ -1081,9 +1081,9 @@ hstore_populate_record(PG_FUNCTION_ARGS)
    10811081
    }
    10821082
    else
    10831083
    {
    1084-
    vallen = HS_VALLEN(entries, idx);
    1084+
    vallen = HSTORE_VALLEN(entries, idx);
    10851085
    value = palloc(1 + vallen);
    1086-
    memcpy(value, HS_VAL(entries, ptr, idx), vallen);
    1086+
    memcpy(value, HSTORE_VAL(entries, ptr, idx), vallen);
    10871087
    value[vallen] = 0;
    10881088

    10891089
    values[i] = InputFunctionCall(&column_info->proc, value,
    @@ -1144,23 +1144,23 @@ hstore_out(PG_FUNCTION_ARGS)
    11441144
    for (i = 0; i < count; i++)
    11451145
    {
    11461146
    /* include "" and => and comma-space */
    1147-
    buflen += 6 + 2 * HS_KEYLEN(entries, i);
    1147+
    buflen += 6 + 2 * HSTORE_KEYLEN(entries, i);
    11481148
    /* include "" only if nonnull */
    1149-
    buflen += 2 + (HS_VALISNULL(entries, i)
    1149+
    buflen += 2 + (HSTORE_VALISNULL(entries, i)
    11501150
    ? 2
    1151-
    : 2 * HS_VALLEN(entries, i));
    1151+
    : 2 * HSTORE_VALLEN(entries, i));
    11521152
    }
    11531153

    11541154
    out = ptr = palloc(buflen);
    11551155

    11561156
    for (i = 0; i < count; i++)
    11571157
    {
    11581158
    *ptr++ = '"';
    1159-
    ptr = cpw(ptr, HS_KEY(entries, base, i), HS_KEYLEN(entries, i));
    1159+
    ptr = cpw(ptr, HSTORE_KEY(entries, base, i), HSTORE_KEYLEN(entries, i));
    11601160
    *ptr++ = '"';
    11611161
    *ptr++ = '=';
    11621162
    *ptr++ = '>';
    1163-
    if (HS_VALISNULL(entries, i))
    1163+
    if (HSTORE_VALISNULL(entries, i))
    11641164
    {
    11651165
    *ptr++ = 'N';
    11661166
    *ptr++ = 'U';
    @@ -1170,7 +1170,7 @@ hstore_out(PG_FUNCTION_ARGS)
    11701170
    else
    11711171
    {
    11721172
    *ptr++ = '"';
    1173-
    ptr = cpw(ptr, HS_VAL(entries, base, i), HS_VALLEN(entries, i));
    1173+
    ptr = cpw(ptr, HSTORE_VAL(entries, base, i), HSTORE_VALLEN(entries, i));
    11741174
    *ptr++ = '"';
    11751175
    }
    11761176

    @@ -1203,20 +1203,20 @@ hstore_send(PG_FUNCTION_ARGS)
    12031203

    12041204
    for (i = 0; i < count; i++)
    12051205
    {
    1206-
    int32 keylen = HS_KEYLEN(entries, i);
    1206+
    int32 keylen = HSTORE_KEYLEN(entries, i);
    12071207

    12081208
    pq_sendint(&buf, keylen, 4);
    1209-
    pq_sendtext(&buf, HS_KEY(entries, base, i), keylen);
    1210-
    if (HS_VALISNULL(entries, i))
    1209+
    pq_sendtext(&buf, HSTORE_KEY(entries, base, i), keylen);
    1210+
    if (HSTORE_VALISNULL(entries, i))
    12111211
    {
    12121212
    pq_sendint(&buf, -1, 4);
    12131213
    }
    12141214
    else
    12151215
    {
    1216-
    int32 vallen = HS_VALLEN(entries, i);
    1216+
    int32 vallen = HSTORE_VALLEN(entries, i);
    12171217

    12181218
    pq_sendint(&buf, vallen, 4);
    1219-
    pq_sendtext(&buf, HS_VAL(entries, base, i), vallen);
    1219+
    pq_sendtext(&buf, HSTORE_VAL(entries, base, i), vallen);
    12201220
    }
    12211221
    }
    12221222

    @@ -1255,20 +1255,24 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
    12551255
    for (i = 0; i < count; i++)
    12561256
    {
    12571257
    resetStringInfo(&tmp);
    1258-
    appendBinaryStringInfo(&tmp, HS_KEY(entries, base, i), HS_KEYLEN(entries, i));
    1258+
    appendBinaryStringInfo(&tmp, HSTORE_KEY(entries, base, i),
    1259+
    HSTORE_KEYLEN(entries, i));
    12591260
    escape_json(&dst, tmp.data);
    12601261
    appendStringInfoString(&dst, ": ");
    1261-
    if (HS_VALISNULL(entries, i))
    1262+
    if (HSTORE_VALISNULL(entries, i))
    12621263
    appendStringInfoString(&dst, "null");
    12631264
    /* guess that values of 't' or 'f' are booleans */
    1264-
    else if (HS_VALLEN(entries, i) == 1 && *(HS_VAL(entries, base, i)) == 't')
    1265+
    else if (HSTORE_VALLEN(entries, i) == 1 &&
    1266+
    *(HSTORE_VAL(entries, base, i)) == 't')
    12651267
    appendStringInfoString(&dst, "true");
    1266-
    else if (HS_VALLEN(entries, i) == 1 && *(HS_VAL(entries, base, i)) == 'f')
    1268+
    else if (HSTORE_VALLEN(entries, i) == 1 &&
    1269+
    *(HSTORE_VAL(entries, base, i)) == 'f')
    12671270
    appendStringInfoString(&dst, "false");
    12681271
    else
    12691272
    {
    12701273
    resetStringInfo(&tmp);
    1271-
    appendBinaryStringInfo(&tmp, HS_VAL(entries, base, i), HS_VALLEN(entries, i));
    1274+
    appendBinaryStringInfo(&tmp, HSTORE_VAL(entries, base, i),
    1275+
    HSTORE_VALLEN(entries, i));
    12721276
    if (IsValidJsonNumber(tmp.data, tmp.len))
    12731277
    appendBinaryStringInfo(&dst, tmp.data, tmp.len);
    12741278
    else
    @@ -1306,15 +1310,17 @@ hstore_to_json(PG_FUNCTION_ARGS)
    13061310
    for (i = 0; i < count; i++)
    13071311
    {
    13081312
    resetStringInfo(&tmp);
    1309-
    appendBinaryStringInfo(&tmp, HS_KEY(entries, base, i), HS_KEYLEN(entries, i));
    1313+
    appendBinaryStringInfo(&tmp, HSTORE_KEY(entries, base, i),
    1314+
    HSTORE_KEYLEN(entries, i));
    13101315
    escape_json(&dst, tmp.data);
    13111316
    appendStringInfoString(&dst, ": ");
    1312-
    if (HS_VALISNULL(entries, i))
    1317+
    if (HSTORE_VALISNULL(entries, i))
    13131318
    appendStringInfoString(&dst, "null");
    13141319
    else
    13151320
    {
    13161321
    resetStringInfo(&tmp);
    1317-
    appendBinaryStringInfo(&tmp, HS_VAL(entries, base, i), HS_VALLEN(entries, i));
    1322+
    appendBinaryStringInfo(&tmp, HSTORE_VAL(entries, base, i),
    1323+
    HSTORE_VALLEN(entries, i));
    13181324
    escape_json(&dst, tmp.data);
    13191325
    }
    13201326

    @@ -1346,20 +1352,20 @@ hstore_to_jsonb(PG_FUNCTION_ARGS)
    13461352
    val;
    13471353

    13481354
    key.type = jbvString;
    1349-
    key.val.string.len = HS_KEYLEN(entries, i);
    1350-
    key.val.string.val = HS_KEY(entries, base, i);
    1355+
    key.val.string.len = HSTORE_KEYLEN(entries, i);
    1356+
    key.val.string.val = HSTORE_KEY(entries, base, i);
    13511357

    13521358
    (void) pushJsonbValue(&state, WJB_KEY, &key);
    13531359

    1354-
    if (HS_VALISNULL(entries, i))
    1360+
    if (HSTORE_VALISNULL(entries, i))
    13551361
    {
    13561362
    val.type = jbvNull;
    13571363
    }
    13581364
    else
    13591365
    {
    13601366
    val.type = jbvString;
    1361-
    val.val.string.len = HS_VALLEN(entries, i);
    1362-
    val.val.string.val = HS_VAL(entries, base, i);
    1367+
    val.val.string.len = HSTORE_VALLEN(entries, i);
    1368+
    val.val.string.val = HSTORE_VAL(entries, base, i);
    13631369
    }
    13641370
    (void) pushJsonbValue(&state, WJB_VALUE, &val);
    13651371
    }
    @@ -1393,22 +1399,24 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
    13931399
    val;
    13941400

    13951401
    key.type = jbvString;
    1396-
    key.val.string.len = HS_KEYLEN(entries, i);
    1397-
    key.val.string.val = HS_KEY(entries, base, i);
    1402+
    key.val.string.len = HSTORE_KEYLEN(entries, i);
    1403+
    key.val.string.val = HSTORE_KEY(entries, base, i);
    13981404

    13991405
    (void) pushJsonbValue(&state, WJB_KEY, &key);
    14001406

    1401-
    if (HS_VALISNULL(entries, i))
    1407+
    if (HSTORE_VALISNULL(entries, i))
    14021408
    {
    14031409
    val.type = jbvNull;
    14041410
    }
    14051411
    /* guess that values of 't' or 'f' are booleans */
    1406-
    else if (HS_VALLEN(entries, i) == 1 && *(HS_VAL(entries, base, i)) == 't')
    1412+
    else if (HSTORE_VALLEN(entries, i) == 1 &&
    1413+
    *(HSTORE_VAL(entries, base, i)) == 't')
    14071414
    {
    14081415
    val.type = jbvBool;
    14091416
    val.val.boolean = true;
    14101417
    }
    1411-
    else if (HS_VALLEN(entries, i) == 1 && *(HS_VAL(entries, base, i)) == 'f')
    1418+
    else if (HSTORE_VALLEN(entries, i) == 1 &&
    1419+
    *(HSTORE_VAL(entries, base, i)) == 'f')
    14121420
    {
    14131421
    val.type = jbvBool;
    14141422
    val.val.boolean = false;
    @@ -1418,7 +1426,8 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
    14181426
    is_number = false;
    14191427
    resetStringInfo(&tmp);
    14201428

    1421-
    appendBinaryStringInfo(&tmp, HS_VAL(entries, base, i), HS_VALLEN(entries, i));
    1429+
    appendBinaryStringInfo(&tmp, HSTORE_VAL(entries, base, i),
    1430+
    HSTORE_VALLEN(entries, i));
    14221431

    14231432
    /*
    14241433
    * don't treat something with a leading zero followed by another
    @@ -1461,14 +1470,14 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
    14611470
    {
    14621471
    val.type = jbvNumeric;
    14631472
    val.val.numeric = DatumGetNumeric(
    1464-
    DirectFunctionCall3(numeric_in, CStringGetDatum(tmp.data), 0, -1));
    1465-
    1473+
    DirectFunctionCall3(numeric_in,
    1474+
    CStringGetDatum(tmp.data), 0, -1));
    14661475
    }
    14671476
    else
    14681477
    {
    14691478
    val.type = jbvString;
    1470-
    val.val.string.len = HS_VALLEN(entries, i);
    1471-
    val.val.string.val = HS_VAL(entries, base, i);
    1479+
    val.val.string.len = HSTORE_VALLEN(entries, i);
    1480+
    val.val.string.val = HSTORE_VAL(entries, base, i);
    14721481
    }
    14731482
    }
    14741483
    (void) pushJsonbValue(&state, WJB_VALUE, &val);

    0 commit comments

    Comments
     (0)
    0