Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 1C2A6D33CC1 for ; Tue, 12 Jun 2012 23:39:52 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SedUt-0000bJ-Dt for pgsql-sql@postgresql.org; Wed, 13 Jun 2012 02:39:51 +0000 Received: by pbbrp8 with SMTP id rp8so1646587pbb.19 for ; Tue, 12 Jun 2012 19:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=8KY2b5zBg79jg6BjXN6mSEHvMDtIAFxdVaYxZfFzaeg=; b=W6UHhH4pbaI38GCsbwznSJKxzE3Bo3HVWqzAv09IjZkDUK6RyP8VDhDeC5xy/HUpBo ylZKZdl1DfWyf3kTVv1r8sUGmm0yIAz5aSzT8tYrFzc4rZjLOw37dxGjQEVFVTFfj8wA jM9DZRC7sZIj6ufJvSVlmw3vrueJD66s6vvqOv6rexfMgTyUXo64MiWUtFPt7WOyCA40 a8YiFqn0WXhnzdp+uuTQin1ULrcQGwKCt79yQe7D0GDmbC/UBLT/vWl01VLvKC/sgS4a kQSw3xDRRow6T4FSTUTVPb/fa/WLQDHmlHgEsMXSn2xsE7h/3CV2NpLSI5z64soOcbhZ 07mw== Received: by 10.68.191.106 with SMTP id gx10mr44546511pbc.37.1339555178747; Tue, 12 Jun 2012 19:39:38 -0700 (PDT) Received: from ayaki.localdomain (office1.postnewspapers.com.au. [150.101.171.128]) by mx.google.com with ESMTPS id py5sm4074735pbb.1.2012.06.12.19.39.36 (version=SSLv3 cipher=OTHER); Tue, 12 Jun 2012 19:39:38 -0700 (PDT) Message-ID: <4FD7FD65.70909@ringerc.id.au> Date: Wed, 13 Jun 2012 10:39:33 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: johnf@jfcomputer.com CC: "pgsql-sql@postgresql.org" Subject: Re: how to use schema with data type References: <4FD7E2FD.9020207@jfcomputer.com> In-Reply-To: <4FD7E2FD.9020207@jfcomputer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnerjE+O1EYeIsAbf+00kK1E6ikwDpGU4S6tSJdwEoP9WiROe6iG45ooj9W/U18CFNAXLNj X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/33 X-Sequence-Number: 36687 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