Re: View fields are cast as text and link to Access as a Memo field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Karen Springer <karen(dot)springer(at)wulfsberg(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: View fields are cast as text and link to Access as a Memo field
Date: 2008-01-30 00:46:35
Message-ID: 28912.1201653995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Karen Springer <karen(dot)springer(at)wulfsberg(dot)com> writes:
> I need employeeName to be a text field in Access. I have tried casting
> the fields in the view as varchar, but it seem to default back to ::text.

The result of a || operator is always going to be type text. Put the
cast around the whole expression, not just the individual fields.
For instance,

CASE
WHEN "Participant_Names"."NameUsed" IS NULL THEN
("Participant_Names"."LastNAME" || ', ') || "Participant_Names"."FirstName"
ELSE ("Participant_Names"."LastNAME" || ', ') || "Participant_Names"."NameUsed"
END :: varchar AS "employeeName"

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Selena Deckelmann 2008-01-30 01:03:55 Re: PGCon vs Postgresql Conference
Previous Message Karen Springer 2008-01-30 00:02:56 View fields are cast as text and link to Access as a Memo field