Re: Me And My Database

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Me And My Database
Date: 2006-06-14 09:38:30
Message-ID: 20060614093830.GD4748@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-general

On Wed, Jun 14, 2006 at 11:35:12AM +0200, Leif B. Kristensen wrote:
> On Wednesday 14. June 2006 11:09, Martijn van Oosterhout wrote:
> >IIRC, if you just declare src as type "record" you can select any
> >fields you like. AIUI, declaring a row to be of a specific type is
> > only really important if you plan to return it or pass it to another
> > function.
>
> I tried:
>
> CREATE OR REPLACE FUNCTION get_source_text(integer) RETURNS TEXT AS $$
> DECLARE
> src RECORD;
> mystring TEXT;
> BEGIN
> SELECT (source_id, parent_id, large_text)
> FROM sources INTO src WHERE source_id = $1;

Why did you put parenthesis there? It looks like you're making a record
within a record. You wouldn't have parenthesis there for a normal
select statement, would you?

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Leif B. Kristensen 2006-06-14 09:45:03 Re: Me And My Database
Previous Message Leif B. Kristensen 2006-06-14 09:35:12 Re: Me And My Database

Browse pgsql-general by date

  From Date Subject
Next Message Leif B. Kristensen 2006-06-14 09:45:03 Re: Me And My Database
Previous Message Leif B. Kristensen 2006-06-14 09:35:12 Re: Me And My Database