"Marc Mamin" <M.Mamin@intershop.de> writes:
> By trying to create a sequence that already exists, I'd expect an error
> like
> relation "foo_20110307_id_seq" already exists,
> and not
> type "foo_20110307_id_seq" already
My recollection is that it's possible to get the latter if multiple
sessions try to create the same relation name concurrently. The initial
check for "does the relation already exist" fails for both sessions,
so they plow ahead, and then you're at the mercy of timing as to whether
you get a unique-index violation on pg_class or pg_type. It may well
also vary as to which PG version you're using.
regards, tom lane