Update entire column with new date values - Mailing list pgsql-general

From Weiss, Kevin
Subject Update entire column with new date values
Date
Msg-id BD328298CB3CDA44841417E3BA302335044DC7BE@exchange1.selkirkinc.com
Whole thread Raw
Responses Re: Update entire column with new date values
Re: Update entire column with new date values
List pgsql-general
Hi all,

I have a simple table which contains information about our safety files:

CREATE TABLE docs
(
  filename varchar(256) NOT NULL,
  filepath varchar(256) NOT NULL,
  version varchar(8),
  date timestamp NOT NULL,
  docid int8 NOT NULL DEFAULT nextval('docs_docid_seq'::regclass),
  category varchar(16), NOT NULL
  CONSTRAINT pkey_docs PRIMARY KEY (docid, filename, date),
  CONSTRAINT ukey_docid UNIQUE (docid)
)

I need to update the date for each file (the "date" & "filename"
columns). However, the updated values for date are not the same for each
file (due to when the files were last modified). I can import the new
date values from a text file containing the date and filename.

What sort of "UPDATE" command do I use in this case? Essentially, I'm
trying to do something like:

UPDATE docs SET date = '{$input_date}'
    FROM ('C:/Temp/docupdate.txt')
    WHERE filename = '{$input_filename}';

Any help is appreciated. Thanks!


Kevin Weiss
kevin.weiss@selkirkinc.com

pgsql-general by date:

Previous
From: "Jasbinder Bali"
Date:
Subject: Permissions to connect to postgres database
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Generating unique session ids