Re: how to do prefix_range default value?

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Cc: Tony Liao <tonyliao(at)yuehetone(dot)com>
Subject: Re: how to do prefix_range default value?
Date: 2009-04-06 09:36:32
Message-ID: 200904061136.35869.dfontaine@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

On Friday 03 April 2009 05:03:37 Tony Liao wrote:
> now I want to insert default value [] to prefix column,because if the
> prefix column is NULL,the returns are not I want (with prefix @>'text').I
> alter column prefix default [],it return error:
> ERROR: syntax error at or near "["
> LINE 2: ALTER COLUMN prefix SET DEFAULT [];

You need to have the value protected into quotes, as it's a literal:

dim=# create table tl(a prefix_range default '[]');
CREATE TABLE
dim=# \d tl
Table "public.tl"
Column | Type | Modifiers
--------+--------------+----------------------------
a | prefix_range | default '[]'::prefix_range

--
dim

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Emanuel Calvo Franco 2009-04-06 13:56:42 Re: COPY-ing ASCII file into UTF-8 database
Previous Message Tommy Gildseth 2009-04-06 06:55:37 Re: COPY-ing ASCII file into UTF-8 database