Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 326B9B5DE15; Wed, 1 Jun 2011 12:43:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 62024-09; Wed, 1 Jun 2011 15:43:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f46.google.com (mail-bw0-f46.google.com [209.85.214.46]) by mail.postgresql.org (Postfix) with ESMTP id CA215B5DE02; Wed, 1 Jun 2011 12:43:15 -0300 (ADT) Received: by bwz15 with SMTP id 15so159194bwz.19 for ; Wed, 01 Jun 2011 08:43:14 -0700 (PDT) Received: by 10.204.29.23 with SMTP id o23mr5144227bkc.18.1306942994562; Wed, 01 Jun 2011 08:43:14 -0700 (PDT) Received: from [192.168.1.104] (233-21-133-95.pool.ukrtel.net [95.133.21.233]) by mx.google.com with ESMTPS id 16sm951991bkm.14.2011.06.01.08.43.12 (version=SSLv3 cipher=OTHER); Wed, 01 Jun 2011 08:43:13 -0700 (PDT) Date: Wed, 1 Jun 2011 18:43:10 +0300 From: Pavel Golub Reply-To: Pavel Golub Organization: Microolap X-Priority: 3 (Normal) Message-ID: <147534417.20110601184310@gf.microolap.com> To: PostgreSQL Hackers , Subject: PQdeleteTuple function in libpq MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/1 X-Sequence-Number: 6946 Hello. I'm some kind of PQdeleteTuple function will be very usefull in libpq. Because right now after deleting some record I need refetch result set, or mark tuple as deleted and this is headache for me. So I checked fe-exec.c sources and wrote this: int PQdeleteTuple(PGresult *src, int tup_num) { if (!src) return NULL; int i, field; /* Invalid tup_num, must be < ntups */ if (tup_num < 0 || tup_num >= src->ntups) return FALSE; free(src->tuples[tup_num]); for (i = tup_num; i < src->ntups - 1; i++) { src->tuples[i] = src->tuples[i + 1]; } src->ntups--; return TRUE; } But I'm pretty sure, that "free(src->tuples[tup_num])" is bullshit! Because memory is allocated by pqResultAlloc, which in turn plays with memory blocks and so on... Can anyone help me in this? PS I'm not a C guru, so don't please kick me hard. :) Thanks. -- With best wishes, Pavel mailto:pavel@gf.microolap.com