Search Postgresql Archives

Re: The connection to the server was lost. Attempting reset: Failed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you so much for your answer. I will be testing the indicated and then I give you return.
Best regards,
Yessica Brinkmann

El jue., 10 oct. 2019 a las 13:15, Alban Hertroys (<haramrae@xxxxxxxxx>) escribió:

> On 10 Oct 2019, at 17:55, Yessica Brinkmann <yessica.brinkmann@xxxxxxxxx> wrote:
>
> I really thought a lot, but I don't understand why but the function fails after the _expression_ is executed:
> appendStringInfo (& cols, "% s a.attnum =% d", (i> 0? "OR": ""), idxcd-> varattno [i]);
> The error appears only to me when entering the cycle:
> foreach (cell, candidates) / * foreach cell in candidates * /
> more than once, that is, when you have more than one candidate index. If the cycle is entered only once, the function works correctly.
> The error that appears to me is that the connection to the PostgreSQL server is directly lost. I proved that the error occurs in that statement, printing some values.

There is probably an error in the Postgres log-file providing you more info.

That said, at least the below bit in your code is dangerous:

    foreach( cell, candidates ) /* foreach cell in candidates */
    {

        idxcd = (IndexCandidate*)lfirst( cell );

        if( !idxcd->idxused )
            continue;

        if (idxcd!=NULL)
        {


You should at least check for NULL before referencing an attribute of that structure. Personally, I would invert the test like so (and then move it before the idxused test:

        if (idxcd == NULL) {
            elog( INFO, "idxcd IS NULL" );
            continue; /* Or is that fatal enough to break instead? */
        )

        if (!idxcd->idxused)
            continue;



Alban Hertroys
--
There is always an exception to always.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux