pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_repack: WARNING: relation must have a primary key or not-null unique keys
4+ messages / 3 participants
[nested] [flat]

* pg_repack: WARNING: relation must have a primary key or not-null unique keys
@ 2020-06-16 10:52  Eugene Pazhitnov <pazhitnov@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Eugene Pazhitnov @ 2020-06-16 10:52 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello everyone!

eugene@dignus:/var/www/html/health$ psql xbox
Timing is on.
psql (12.3 (Ubuntu 12.3-1.pgdg20.04+1))
Type "help" for help.

xbox=> \d herostat
                   Table "public.herostat"
  Column  |       Type       | Collation | Nullable | Default
----------+------------------+-----------+----------+---------
 xuid     | bigint           |           | not null |
 titleid  | bigint           |           | not null |
 value    | text             |           |          |
 valfloat | double precision |           |          |
 heroid   | integer          |           | not null |
Indexes:
    "herostat_pkey" PRIMARY KEY, btree (xuid, titleid, heroid) INCLUDE
(valfloat)
    "herostat_heroid_idx" btree (heroid)
    "herostat_titleid_idx" btree (titleid)
Triggers:
    herostat_min_update BEFORE UPDATE ON herostat FOR EACH ROW EXECUTE
FUNCTION suppress_redundant_updates_trigger()

xbox=> \q
eugene@dignus:/var/www/html/health$ sudo -u postgres pg_repack -t herostat
-N -d xbox
INFO: Dry run enabled, not executing repack
WARNING: relation "public.herostat" must have a primary key or not-null
unique keys
eugene@dignus:/var/www/html/health$ pg_repack --version
pg_repack 1.4.5
eugene@dignus:/var/www/html/health$

What is wrong and what I can do to fix it?

-- 
Evgeny Pazhitnov

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_repack: WARNING: relation must have a primary key or not-null unique keys
@ 2020-06-16 14:08  Michael Lewis <mlewis@entrata.com>
  parent: Eugene Pazhitnov <pazhitnov@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Michael Lewis @ 2020-06-16 14:08 UTC (permalink / raw)
  To: Eugene Pazhitnov <pazhitnov@gmail.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

On Tue, Jun 16, 2020, 4:52 AM Eugene Pazhitnov <pazhitnov@gmail.com> wrote:

> xbox=> \d herostat
>                    Table "public.herostat"
> Indexes:
>     "herostat_pkey" PRIMARY KEY, btree (xuid, titleid, heroid) INCLUDE
> (valfloat)
>
> WARNING: relation "public.herostat" must have a primary key or not-null
> unique keys
>
> What is wrong and what I can do to fix it?
>

I don't know, but I would guess that the "include" option is not supported
by pg_repack.

>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_repack: WARNING: relation must have a primary key or not-null unique keys
@ 2020-06-16 14:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Eugene Pazhitnov <pazhitnov@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Tom Lane @ 2020-06-16 14:12 UTC (permalink / raw)
  To: Eugene Pazhitnov <pazhitnov@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Eugene Pazhitnov <pazhitnov@gmail.com> writes:
> xbox=> \d herostat
> ...
>     "herostat_pkey" PRIMARY KEY, btree (xuid, titleid, heroid) INCLUDE (valfloat)

> eugene@dignus:/var/www/html/health$ sudo -u postgres pg_repack -t herostat
> -N -d xbox
> INFO: Dry run enabled, not executing repack
> WARNING: relation "public.herostat" must have a primary key or not-null
> unique keys

Apparently pg_repack can't work with a primary key index that has INCLUDE
columns.  I have no idea whether that's a fundamental limitation or it's
just that pg_repack hasn't been taught about the INCLUDE feature.  In
either case, you need to go consult pg_repack's author(s), who may or
may not keep up on this list.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_repack: WARNING: relation must have a primary key or not-null unique keys
@ 2020-06-16 21:30  Eugene Pazhitnov <pazhitnov@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Eugene Pazhitnov @ 2020-06-16 21:30 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@lists.postgresql.org

Ok, thanks a lot! Got it.

вт, 16 июн. 2020 г. в 17:12, Tom Lane <tgl@sss.pgh.pa.us>:

> Eugene Pazhitnov <pazhitnov@gmail.com> writes:
> > xbox=> \d herostat
> > ...
> >     "herostat_pkey" PRIMARY KEY, btree (xuid, titleid, heroid) INCLUDE
> (valfloat)
>
> > eugene@dignus:/var/www/html/health$ sudo -u postgres pg_repack -t
> herostat
> > -N -d xbox
> > INFO: Dry run enabled, not executing repack
> > WARNING: relation "public.herostat" must have a primary key or not-null
> > unique keys
>
> Apparently pg_repack can't work with a primary key index that has INCLUDE
> columns.  I have no idea whether that's a fundamental limitation or it's
> just that pg_repack hasn't been taught about the INCLUDE feature.  In
> either case, you need to go consult pg_repack's author(s), who may or
> may not keep up on this list.
>
>                         regards, tom lane
>


-- 
Evgeny Pazhitnov

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-06-16 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 10:52 pg_repack: WARNING: relation must have a primary key or not-null unique keys Eugene Pazhitnov <pazhitnov@gmail.com>
2020-06-16 14:08 ` Michael Lewis <mlewis@entrata.com>
2020-06-16 14:12 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-06-16 21:30   ` Eugene Pazhitnov <pazhitnov@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox