dataegret / pgcompacttable

BSD 3-Clause "New" or "Revised" License
314 stars 48 forks source link

error fix for pg_trigger query & spelling typo #7

Open dland opened 7 years ago

dland commented 7 years ago

On 9.6 I was unable to run pgcompacttable without the casting tgtype to integer. You can't cast 16 to shortint because Pg doesn't know how to cast from smallint to boolean implicitly.

Also fixed a spelling typo that was bugging me :)

Melkij commented 7 years ago

Hi I can not reproduce error...

melkij=> SELECT count(1) FROM pg_catalog.pg_trigger
  WHERE
      tgrelid = 'foo'::regclass AND
      (tgtype & 16)::boolean;
-[ RECORD 1 ]
count | 1

melkij=> select version();
-[ RECORD 1 ]-------------------------------------------------------------------------------------
version | PostgreSQL 9.6.5 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit
dland commented 7 years ago

What was I thinking when I wrote that? It wasn't 9.6... it concerns an earlier version, 9.2 or 9.3.

Melkij commented 7 years ago

Not reproduced in freshly installed 9.5, 9.4, 9.3, 9.2 and even unsupported 9.1 =) Maybe some extensions was installed or custom operators defined?

Error "operator is not unique: smallint & integer" means what both operands types and operator is known. pg_operator system view has unique constraint on (oprname, oprleft, oprright, oprnamespace), so not unique operator is possible only with different namespaces and I think problem was in specific database schema.

dland commented 7 years ago

Hmm, ok. I guess we can leave this here then. (Although the spelling typo is worth fixing :)