X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5B8CFD6D17 for ; Fri, 11 Nov 2005 16:03:19 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25714-05 for ; Fri, 11 Nov 2005 20:03:15 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 816FCD9D12 for ; Fri, 11 Nov 2005 16:03:12 -0400 (AST) Received: (qmail 26590 invoked from network); 11 Nov 2005 20:03:14 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 11 Nov 2005 20:03:14 -0000 From: "Greg Sabino Mullane" To: pgsql-sql@postgresql.org Cc: fbax@sympatico.ca CC: fbax@sympatico.ca Subject: Re: cli in sql? X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <5.2.1.1.0.20051111085132.04119120@pop6.sympatico.ca> Date: Fri, 11 Nov 2005 20:03:14 -0000 X-Mailer: JoyMail 1.48 Message-ID: <1bb9fe33ef04362819dae06d5326b2ac@biglumber.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.079 required=5 tests=[AWL=0.079, UPPERCASE_25_50=0] X-Spam-Score: 0.079 X-Spam-Level: X-Archive-Number: 200511/106 X-Sequence-Number: 23357 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message > If my database has column containing a filename, can I use sql to present > this filename and datemodified (as output from 'ls -l' or from mtime() > fuction) or *must* it be done after the query in interface such as php or perl? Neither. You can do it inside the db with a "pl" language such as plperlu: CREATE OR REPLACE FUNCTION filemodtime(TEXT) RETURNS TEXT LANGUAGE plperlu AS $$ my $filename = shift; -e $filename or elog(ERROR, qq{The file "$filename" does not exist\n}); return localtime($^T - (60*60*24* -M _)); $$; SELECT filemodtime('/var/log/messages'); SELECT filemodtime('/dark/matter'); -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200511111457 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFDdPkRvJuQZxSWSsgRAufUAJ9f4/IaYrJDMi3Yg74x0tkN4tmUcQCgmlu9 wAkqRHgYQY9DtdIIfH/g7xY= =n/J7 -----END PGP SIGNATURE-----