CREATE VIEW blah AS SELECT DISTINCT etc

From: "Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk>
To: <pgsql-general(at)postgresql(dot)org>
Subject: CREATE VIEW blah AS SELECT DISTINCT etc
Date: 1999-10-22 09:13:50
Message-ID: 001801bf1c6d$c1404190$760e01a3@oucs.ox.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I don't see implement SELECT DISTINCT in views on the To Do list?

I'm using 6.5.2, and on doing
CREATE VIEW blahview AS SELECT DISTINCT bleurgh,blaagh FROM blah;

I get
ERROR: DISTINCT not supported in views.

However, the \h command in psql gives
CREATE VIEW view_name AS
SELECT [DISTINCT [ON attrN]]
etc.

I can't find the bug report form on the WWW to submit a bug report for
psql on this. The FAQ merely says

1.13) How do I submit a bug report?

Fill out the "bug-template" file and send it to: bugs(at)postgreSQL(dot)org

No indication of how to get hold of the bug-template file...

Thanks,
Moray

----------------------------------------------------------------------
----------------
Moray(dot)McConnachie(at)computing-services(dot)oxford(dot)ac(dot)uk
----- Original Message -----
From: Aaron J. Seigo <aaron(at)gtv(dot)ca>
To: Moray McConnachie
<moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk>;
<greg(at)proterians(dot)net>
Cc: <pgsql-general(at)postgreSQL(dot)org>
Sent: Friday, October 15, 1999 7:58 PM
Subject: Re: [GENERAL] User defined function

> hi...
>
> >
> > > CREATE FUNCTION startofregyear(date) RETURNS date AS '
> > > SELECT text_datetime(''01/12/''
> > float8_text(datepart(''year'',$1)-1))
> > > AS answer;
> > > ' LANGUAGE 'SQL';
> >
> > absolutely not, I tried that already.
> > I get "attribute not found" error wherever the opening
double-quotes
> > are during the create of the function.
>
> try this (it works quite nicely):
> select (''12-1-'' || date_part(''year'',$1) - 1)::date;
>
> your problem is 2 fold. first, you need double quotes. second, it
isn't
> datepart, its date_part. that's the "attribute not found" error.
>
> as a suggestion, try doing the select statement from the command
line outside
> of a function first to make sure it works. i.e:
> select ('12-1-' || date_part('year','now'::date) - 1)::date;
>
> once you know that your select works, pop it into the function.
functions don't
> return the most helpful error messages =) the command line in psql
is much
> better for debugging selects/inserts/etc/etc...
>
>
> --
> Aaron J. Seigo
> Sys Admin
>
> ************
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob Kline 1999-10-22 12:49:41 Re: [GENERAL] CREATE VIEW blah AS SELECT DISTINCT etc
Previous Message Christian Rudow 1999-10-22 06:25:19 Re: What's WAL