I did the function. But I'm calling it with select
function_name(table_name) , and I getting errors in nfacctd.log:
ERROR ( default/pgsql ):
ERROR ( default/pgsql ):
Here is the function, if anyone wanna do something similar:
CREATE OR REPLACE FUNCTION cria_tab_pmacct(text)
RETURNS void AS $$
DECLARE
myrec RECORD;
BEGIN
SELECT relname INTO myrec FROM pg_class WHERE relname=$1;
IF NOT FOUND
THEN
EXECUTE 'PERFORM CREATE TABLE ' || quote_ident($1) || ' (
....
)';
EXECUTE 'CREATE INDEX ...';
END IF;
END;
$$ LANGUAGE plpgsql;
In table_schema file, I'm calling
select cria_tab_pmacct('acct_%Y_%m);
Maybe because of the select. Just wanna know why it is still logging?
2010/4/30 Paolo Lucente <[email protected]>:
> Hi Sergio,
>
> On Thu, Apr 29, 2010 at 11:23:35AM -0300, Sergio Charpinel Jr. wrote:
>
>> Does anyone know what this mean? I getting a lot of them in pmacctd.log
>> Expiring orphan fragment: ip_src=210.197.202.84 ip_dst=200.137.66.1 proto=17
>> id=8885
>
> It means some IP fragments have been staying too long into the pmacctd
> fragment handler waiting for the missing pieces to come. If not in huge
> amounts, this can be sympthom of white noise on the public internet
> (scans, attacks, etc.).
>
>> Regarding the topic, when using dynamic tables with postgreSQL, How can I
>> verify if a table already exists before trying to create them, to avoid a
>> lot of 'Table already exists' messages in nfacctd.log with dynamic table?
>
> I'm not sure there is something already cooked to circumvent that. It
> should be possible though with a few lines of PL/PGSQL, ie.:
>
> IF EXISTS (SELECT relname FROM pg_class WHERE relname='<table>')
> THEN
> ...
> ELSE
> ...
> ENDIF
>
> The simplest way should be to get the table name as parameter and embed
> the actual SQL table schema within the function declaration.
>
> Cheers,
> Paolo
>
>
> _______________________________________________
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists
>
--
Sergio Roberto Charpinel Jr.
_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists