Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edJ8W-000873-RO for pgsql-bugs@arkaria.postgresql.org; Sun, 21 Jan 2018 17:10:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edJ8W-0007O5-5z for pgsql-bugs@arkaria.postgresql.org; Sun, 21 Jan 2018 17:10:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1edJ8V-0007Nw-P0 for pgsql-bugs@lists.postgresql.org; Sun, 21 Jan 2018 17:10:28 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1edJ8N-0007MI-Sv for pgsql-bugs@lists.postgresql.org; Sun, 21 Jan 2018 17:10:26 +0000 Received: by mail-wr0-x244.google.com with SMTP id 36so6072655wrh.1 for ; Sun, 21 Jan 2018 09:10:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=2iaan1PWv5vEvir+rrDvgk+fJpRT4TBuPGTvbuGgP8Q=; b=eaO1yBikkBVXBofZR3gqohsAB0977+/MSjdFbDpFWFUJfk4UiviYJ3gzslJ9ii/r0W +3O3IdMuCyLl7XcA1cPNAGdrTXE5l4mD6bv6aZBa3OQ7CMNmgFmC36XFRNNCi1P6/jzq EFfiFHGN65j9IAhrH01HtYCp816nQKQf+t9LDvSuZ9IGjMl00cvfis/nVDNZtl++aKUw x+r3ASio7RxioXEcmckPhkqFpssyGsrRXisAxDe9fftvucZguwCM3Xrx1ckBLjKC6SIN thei9t4RVZM0yfib6RNfvxQs0R/TU/kdx33s7T9Y/SOKnSxYijUEcJYtKkO1l4TmcrXs wsDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2iaan1PWv5vEvir+rrDvgk+fJpRT4TBuPGTvbuGgP8Q=; b=StCZIYRZM7DbGrKa0ALhbeQmJASFZBoJLmkj1+KFsoQ6W6/YX11DEdaGWKR37QaFz+ 1ECa3pXw2CtRMriMgEr9m2d2CkLhmqiCETy0VdSwPSN8Bq/6F8MMWoo3pBZ1jMwqefvq inlRxIzlAj9UNSwqB+dMUPAv2NUrRb0OR2eUe2x6tf4Rbo5CQe0eprcje0sj9JFT665s cbCWRB71nI3Ez1Dd60treVq4fbRfsouYbbtR41Lks9DU71iqzPzvUZiULJawW4SzHPqn QjoQbyXx8IcyoshhCgYa7xxvdaTSVLQlJrGKM6ybFqrIec14nR0SDQ1+Mp3Ok1E6j6US oYnw== X-Gm-Message-State: AKwxytfA98MRKTIO8IeGUrnKW4C6+nd5QECRvnu8s/z9bymFglGfirc8 NfWBfLsX2UEdW8iWnPEwQgKa/g== X-Google-Smtp-Source: AH8x224G8FjCK7KtrxYiHqPxeeXxIRuGJqtlFISTvnitErqUpJvcgZ/W2a8iLLEU49pPbyi3IG7PEA== X-Received: by 10.223.136.150 with SMTP id f22mr4087278wrf.246.1516554618011; Sun, 21 Jan 2018 09:10:18 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id e67sm12201903wmf.7.2018.01.21.09.10.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jan 2018 09:10:17 -0800 (PST) Subject: Re: BUG #15023: problem with pg_statistic To: ktr@goldin-rudahl.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form References: <20180121025924.3633.29967@wrigleys.postgresql.org> From: Tomas Vondra Message-ID: <95b5276d-2461-3312-bce0-670b0d29e3b0@2ndquadrant.com> Date: Sun, 21 Jan 2018 18:10:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180121025924.3633.29967@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 01/21/2018 03:59 AM, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 15023 > Logged by: kurt rudahl > Email address: ktr@goldin-rudahl.com > PostgreSQL version: Unsupported/Unknown > Operating system: linux > Description: > > Problem: cannot reindex pg_statistic > therefore cannot vacuum > > Steps to recreate: > 1. restart postgresql > 2. psql thaistocks > > \set VERBOSITY verbose > thaistocks=# reindex table pg_statistic; > ERROR: 23505: could not create unique index > DETAIL: Table contains duplicated values. > LOCATION: comparetup_index, tuplesort.c:2163 > > thaistocks=# select starelid,staattnum from pg_statistic group by > starelid,staattnum having count(*) > 1; > starelid | staattnum > ----------+----------- > 10723 | 5 > 10728 | 1 > 1260 | 9 > (3 rows) > It's really difficult (read: impossible) to help you unless you tell us more - for example what PostgreSQL version you're running, how did you get into this situation (e.g. any crashes recently?). In any case, this seems like a case of data corruption, possibly due to a bug (not sure which PostgreSQL version you're using) hardware failure or misconfiguration (e.g. system not handling fsync correctly). If that's the case, I'd suspect there are other corrupted tables. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services