pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to use schema with data type
2+ messages / 2 participants
[nested] [flat]

* how to use schema with data type
@ 2012-06-13 00:46 John Fabiani <johnf@jfcomputer.com>
  2012-06-13 02:39 ` Re: how to use schema with data type Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 1 reply; 2+ messages in thread

From: John Fabiani @ 2012-06-13 00:46 UTC (permalink / raw)
  To: pgsql-sql

I have tried to use a user defined data type I created within a schema.  
But I could not figure it out.

CREATE OR REPLACE FUNCTION xchromasun._chromasun_totals(date)
   RETURNS SETOF xchromasun.weekly_mpr AS

CREATE OR REPLACE FUNCTION xchromasun._chromasun_totals(date)
   RETURNS SETOF "xchromasun.weekly_mpr" AS

I had to move the user defined data type to "public".

Could someone explain how I might get that done - that is use a schema 
data type from a function.

I'm using 8.4.x.

Johnf



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

* Re: how to use schema with data type
  2012-06-13 00:46 how to use schema with data type John Fabiani <johnf@jfcomputer.com>
@ 2012-06-13 02:39 ` Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 0 replies; 2+ messages in thread

From: Craig Ringer @ 2012-06-13 02:39 UTC (permalink / raw)
  To: johnf@jfcomputer.com; +Cc: pgsql-sql

On 06/13/2012 08:46 AM, John Fabiani wrote:
> I have tried to use a user defined data type I created within a schema.
> But I could not figure it out.
>
> CREATE OR REPLACE FUNCTION xchromasun._chromasun_totals(date)
>    RETURNS SETOF xchromasun.weekly_mpr AS
>
> CREATE OR REPLACE FUNCTION xchromasun._chromasun_totals(date)
>    RETURNS SETOF "xchromasun.weekly_mpr" AS
>
> I had to move the user defined data type to "public".
>
> Could someone explain how I might get that done - that is use a schema
> data type from a function.

What exactly couldn't you work out?

How was it going wrong, and when? What error messges did you get?

The first form looks reasonable to me, though I haven't tested. If you 
need to quote the schema for caps reasons, you'd use:

    "xchromasun"."weekly_mpr"


--
Craig Ringer





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


end of thread, other threads:[~2012-06-13 02:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 00:46 how to use schema with data type John Fabiani <johnf@jfcomputer.com>
2012-06-13 02:39 ` Craig Ringer <ringerc@ringerc.id.au>

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