Re: [SQL] Need help with search-and-replace
On Sunday 06 May 2001 10:27, Josh Berkus wrote:
> Folks,
>
> I need to strip certain columns out of my pgdump file. However, I
> can't figure out how to use any Unix-based tool to search-and-replace a
> specific value which includes a tab character (e.g. replace "{TAB}7
> 00:00:00" with "" to eliminate the column).
In other words you wish to remove one field from a tab delimited file?
> RIght now, I'm copying the file to a Win32 machine and using MS Word
> for the search-and-replace,
Oh no! MS is bound to screw it up somehow.
> but I'm sure there's got to be a better way
> ... *without* learning VI or Emacs. Help
man cut is your friend.
info cut is another friend if you are on a GNU system.
cat the.file | cut -f1,3- # assuming is the field you wish to remove is
the second one.
cut uses the tab character as the delimiter by default.
single line file attached
--
Sincerely etc.,
NAME Christopher Sawtell
CELL PHONE 021 257 4451
ICQ UIN45863470
EMAIL csawtell @ xtra . co . nz
CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz
-->> Please refrain from using HTML or WORD attachments in e-mails to me <<--
The first text field700:00:00:00the next field
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
[SQL] update error
I try update table_a set trn_no = table_b.trn_no from table_a,table_b where table_a.cust_no=table_b.cust_no IN pgsql 7.0x IS OK if run 7.1 IS error ?? ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] create table
On Sun, Apr 29, 2001 at 09:34:29PM +0200, LeoDeBeo wrote: > can anybody explain me the syntax of Create Table documentation?? ... > i also don't understand what the [ ... ] and [, ... ] means. I do know that > brackets denote options and | alternatives. I guess: ``[ ... ]'' means that you may repeat the clause, and ``[, ... ]'' means that you may repeat the clause, using a comma for separation Albert. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [SQL] update error
"guard" <[EMAIL PROTECTED]> writes: > update table_a set trn_no = table_b.trn_no from table_a,table_b > where table_a.cust_no=table_b.cust_no > IN pgsql 7.0x IS OK > if run 7.1 IS error ?? More details please? regards, tom lane ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
[SQL] 7.1 REFERENCES contstraints
I see that the REFERENCES constraint is a little more restrictive in 7.1. I need to have a table with a constraint so one of it's columns must exist in a second table. This is not a key, since there may be N columns in the second table that match. Any ideas on how I should create this? CREATE table foo( id serial, permissions int4, FOREIGN KEY (permissions) REFERENCES bar(permid)); used to work in 7.0 but now it complains with: psql:ddl.sql:103: ERROR: UNIQUE constraint matching given keys for referenced table "permissions" not found -Michael _ http://fastmail.ca/ - Fast Free Web Email for Canadians ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] 7.1 REFERENCES contstraints
On Sun, 6 May 2001, Michael Richards wrote: > I see that the REFERENCES constraint is a little more restrictive in > 7.1. I need to have a table with a constraint so one of it's columns > must exist in a second table. This is not a key, since there may be N > columns in the second table that match. Any ideas on how I should > create this? > > CREATE table foo( > id serial, > permissions int4, > FOREIGN KEY (permissions) REFERENCES bar(permid)); > > used to work in 7.0 but now it complains with: > psql:ddl.sql:103: ERROR: UNIQUE constraint matching given keys for > referenced table "permissions" not found You can't do this using references. SQL requires that the second table must have a unique constraint on those columns. The semantics of match partial would be close (but we don't have that yet), but the match unspecified and match full semantics don't really work right if it isn't unique (for example, any deletes from the second table where referenced would fail even if there were additional rows that could satisfy the constraint, also, cascaded deletes would for example happen on the first deletion of a matching row). While you could make the constraint in 7.0, it really didn't work "right." ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
