Skip site navigation (1) Skip section navigation (2)

Re: copy commands and linefeeds

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Mija Lee <mija(at)scharp(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: copy commands and linefeeds
Date: 2007-09-19 21:11:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Wed, 2007-09-19 at 11:19 -0700, Mija Lee wrote:
> Oliver:
> thanks so much for the help. Just for folks who might be looking on the list, 
> Oliver's suggestion works with 8.1 and above:
> 	alter table mytable add check (mycolumn !~ E'[\n\r]');
> whereas this works on 8.0:
> 	alter table mytable add check (mycolumn !~ '\\r\\n');

But don't forget the square brackets: '[\\r\\n]'
otherwise you would match only a return followed by a linefeed rather
than either by itself.

> Maybe everyone already knows this...
> Mija
Oliver Elphick                                          olly(at)lfix(dot)co(dot)uk
Isle of Wight                    
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
   Do you want to know God?

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

In response to

pgsql-novice by date

Next:From: Chris BrowneDate: 2007-09-19 21:51:19
Subject: Re: ON INSERT => execute AWK/SH/EXE?
Previous:From: Mija LeeDate: 2007-09-19 18:19:43
Subject: Re: copy commands and linefeeds

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group