pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: norbi@nix.hu
To: pgsql-bugs@postgresql.org
Subject: BUG #7763: "CREATE TABLE ... (LIKE ... INCLUDING INDEXES ...)" does not work with indexes on composite types
Date: Thu, 20 Dec 2012 12:40:44 +0000
Message-ID: <E1TlfQa-0005LY-PL@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      7763
Logged by:          Norbert Buchmuller
Email address:      norbi@nix.hu
PostgreSQL version: 9.2.2
Operating system:   Linux 2.6.32, i386, Debian GNU/Linux 6.0.5
Description:        

There's a table that has a B-Tree index on a composite type expression. When
attempting to create another table just like the first table and with the
indexes also "copied" using the "CREATE TABLE ... (LIKE ... INCLUDING
INDEXES ...)" statement, it throws an error (see below) and the table is not
created.

I believe it's a bug, from the documentation i assumed that it should create
the table with a similar index, no matter that the index is on a composite
type expression.

postgres@vger:~$ cat
create_table_like_including_indexes-and-index_on_composite_type.sql 
\set VERBOSITY verbose 
\set ECHO all
SELECT version();
CREATE TYPE type1 AS (x int, y int);
CREATE TABLE table1 (a int, b int);
CREATE INDEX index1 ON table1 ( ( (a, b)::type1 ) );
CREATE TABLE table2 ( LIKE table1 INCLUDING INDEXES );
\d table2
postgres@vger:~$ dropdb test1; createdb test1 && psql --no-align --tuples -d
test1 -f create_table_like_including_indexes-and-index_on_composite_type.sql

SELECT version();
PostgreSQL 9.2.2 on i686-pc-linux-gnu, compiled by gcc-4.4.real (Debian
4.4.5-8) 4.4.5, 32-bit
CREATE TYPE type1 AS (x int, y int);
CREATE TYPE
CREATE TABLE table1 (a int, b int);
CREATE TABLE
CREATE INDEX index1 ON table1 ( ( (a, b)::type1 ) );
CREATE INDEX
CREATE TABLE table2 ( LIKE table1 INCLUDING INDEXES );
psql:create_table_like_including_indexes-and-index_on_composite_type.sql:7:
ERROR:  42P16: column "" has pseudo-type record
LOCATION:  CheckAttributeType, heap.c:496
\d table2
Did not find any relation named "table2".



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (7+ messages)  latest in thread

Message-ID: <E1TlfQa-0005LY-PL@wrigleys.postgresql.org>
Permalink:  ../E1TlfQa-0005LY-PL@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1TlfQa-0005LY-PL@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: norbi@nix.hu
  Subject: Re: BUG #7763: "CREATE TABLE ... (LIKE ... INCLUDING INDEXES ...)" does not work with indexes on composite types
  In-Reply-To: <E1TlfQa-0005LY-PL@wrigleys.postgresql.org>
  References: <E1TlfQa-0005LY-PL@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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