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

Re: Get file size

From: Matt Musgrove <MMusgrove(at)efji(dot)com>
To: "Lukas(at)fmf(dot)vtu(dot)lt" <Lukas(at)fmf(dot)vtu(dot)lt>, "pgsql-novice(at)postgresql(dot)org"<pgsql-novice(at)postgresql(dot)org>
Subject: Re: Get file size
Date: 2012-09-05 15:15:28
Message-ID: C0FE28B9352B6F4F8CE371643EC3B2512109E60B@EFJDFWMB01.EFJDFW.local (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
plpgsql is a trusted language so it can't access the file system. 

I'd do it with plpgperlu but then again, Perl is my favorite language.

// Totally off-the-cuff (i.e. untested) example code to get you started 
CREATE FUNCTION check_file_size (character varying) 
    my ( $filepath ) = @_;
    return 0 unless defined $filepath;
    return -s $filepath; # returns size in bytes
$BODY$ LANGUAGE plperlu;

From: pgsql-novice-owner(at)postgresql(dot)org [pgsql-novice-owner(at)postgresql(dot)org] on behalf of Lukas [Lukas(at)fmf(dot)vtu(dot)lt]
Sent: Tuesday, September 04, 2012 2:39 PM
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] Get file size


 maybe someone can give an idea how I cat get sizes of file which location
is know?
 Lets say I have table with 200k records, in every record one column
indicates full file path on server for ex. "c:\temp\test.txt" etc. and I
want to fill that table with file sizes..
 I was looking for function in plpgsql or plpgper languages, but I did not
found anything what could help me..


Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
To make changes to your subscription:

In response to

pgsql-novice by date

Next:From: Majid AzimiDate: 2012-09-05 18:03:11
Subject: TimeZone parameter in postgresql.conf
Previous:From: lazyPGDBADate: 2012-09-05 15:02:42
Subject: pg_dump error on hot standy db (msg or pg_toast missing a chunk number).

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