pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Schemata & User-Defined-Type casting issues
2+ messages / 2 participants
[nested] [flat]

* Schemata & User-Defined-Type casting issues
@ 2004-06-01 14:00  Chris Gamache <cgg007@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Chris Gamache @ 2004-06-01 14:00 UTC (permalink / raw)
  To: pgsql-sql

PostgreSQL 7.4.2 ...

Background: I'm attempting to migrate tables which were created in the
pre-schema days to a sensible schema setup. I'm using the "uniqueidentifier"
column in some of these tables. When I created the new schema, I created an
instance of "uniqueidentifier" and its supporting functions and casts within
the new schema. When I try to "INSERT INTO myschema.mytable ... SELECT ... FROM
public.mytable;" It's having difficulty seeing that the data types are
compatible across the schema. An explicit cast (without first casting to a
neuter data-type) won't work for the same reason.

I'm torn: Should I create a "cast" to allow for casting of this data-type
across schemas, or should I have created the table referencing the user-defined
type in the public schema? 

I expect that this problem will rise up now and again. I'd like to solve it in
the this early phase with a proper deisgn-based fix.

If it makes a difference, I would like to not include this schema in the search
path, to explicitly refer to it as myschema.mytable anywhere I need to
reference it.

CG


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 



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

* Re: Schemata & User-Defined-Type casting issues
@ 2004-06-01 14:25  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Chris Gamache <cgg007@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2004-06-01 14:25 UTC (permalink / raw)
  To: cgg007@yahoo.com; +Cc: pgsql-sql

Chris Gamache <cgg007@yahoo.com> writes:
> I'm using the "uniqueidentifier" column in some of these tables. When
> I created the new schema, I created an instance of "uniqueidentifier"
> and its supporting functions and casts within the new schema. When I
> try to "INSERT INTO myschema.mytable ... SELECT ... FROM
> public.mytable;" It's having difficulty seeing that the data types are
> compatible across the schema.

Indeed, since as far as the system knows those two datatypes have
nothing to do with each other.  I'd go ahead and define an assignment
cast WITHOUT FUNCTION to let you do the conversion.

			regards, tom lane



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


end of thread, other threads:[~2004-06-01 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-06-01 14:00 Schemata & User-Defined-Type casting issues Chris Gamache <cgg007@yahoo.com>
2004-06-01 14:25 ` Tom Lane <tgl@sss.pgh.pa.us>

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