X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9C0F9D1B501 for ; Tue, 21 Oct 2003 01:40:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 45319-08 for ; Mon, 20 Oct 2003 22:40:11 -0300 (ADT) Received: from hotmail.com (bay9-f15.bay9.hotmail.com [64.4.47.15]) by svr1.postgresql.org (Postfix) with ESMTP id DBD55D1B518 for ; Mon, 20 Oct 2003 22:40:07 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 20 Oct 2003 18:40:12 -0700 Received: from 134.29.51.159 by by9fd.bay9.hotmail.msn.com with HTTP; Tue, 21 Oct 2003 01:40:11 GMT X-Originating-IP: [134.29.51.159] X-Originating-Email: [cstotes@hotmail.com] From: "Clint Stotesbery" To: pgsql-sql@postgresql.org Subject: assorted Postgres SQL/ORDBMS questions Date: Tue, 21 Oct 2003 01:40:11 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 21 Oct 2003 01:40:12.0150 (UTC) FILETIME=[44B94960:01C39774] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/262 X-Sequence-Number: 15662 1. You can raise exceptions but you can't catch exceptions in pgsql right? 2. Does Postgres support ORDBMS operations? Specifically I am wondering about the ability to define your own objects and create functions/procedures for the objects (e.g. object.method()). In Oracle I would use CREATE TYPE and CREATE TYPE BODY. Postgres' create type seems quite different than Oracle's version and they don't seem equivalent to each other. The Postgres version seems like it is for creating your own datatypes but not your own objets. I couldn't find any docs on this except on the SQL commands page. 3. Does it support nested tables? Again I couldn't find any info in the docs for this. 4. Can dates only be storied in YYYY-MM-DD format? I've looked over the documentation at http://www.postgresql.org/docs/7.3/static/functions-formatting.html and it seems that doing to_date(t_date,''DD-MON-YYYY'') should return 20-OCT-2003 but it returns 2003-10-20 no matter what I do. An example: CREATE OR REPLACE FUNCTION datetest() RETURNS date AS ' DECLARE t_date varchar; v_date date; BEGIN t_date := to_char(now(),''DD-MON-YYYY''); v_date := to_date(t_date,''DD-MON-YYYY''); RETURN v_date; END; ' LANGUAGE 'plpgsql'; SELECT datetest(); this returns: datetest ---------- 2003-10-20 I wanted it to return 20-OCT-2003 and the documentation suggests that I should be able to do that yet it doesn't actually do it. Now slightly different: CREATE OR REPLACE FUNCTION datetest() RETURNS varchar AS ' DECLARE t_date varchar; v_date date; BEGIN t_date := to_char(now(),''DD-MON-YYYY''); v_date := to_date(t_date,''DD-MON-YYYY''); RETURN t_date; END; ' LANGUAGE 'plpgsql'; SELECT datetest(); This returns: ---------- datetest 20-OCT-2003 This works fine but it is a varchar. I really want it to be stored like that but in a date type instead. Thanks for the answers! -Clint _________________________________________________________________ Add MSN 8 Internet Software to your current Internet access and enjoy patented spam control and more. Get two months FREE! http://join.msn.com/?page=dept/byoa