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

string is sometimes null ?

From: Graeme Hinchliffe <graeme(dot)hinchliffe(at)zeninternet(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: string is sometimes null ?
Date: 2004-09-29 15:03:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
	I have written a PL/PGSQL function which tots up users accounting
information from their RADACCT data on the fly.  So each insert or
update modifies their totals.

	This has worked without error when I have tested it by hand with hand
crafted inserts and updates, however when I put it on the actual live
accounting server (both systems are running 7.4.3) it seems to work

	The RADIUS server is reporting problems when trying to write START of
accounting entries, and the error given is:

ERROR:  cannot EXECUTE a null querystring CONTEXT:  PL/pgSQL function
"radacct_trig" line 43 at open

The lines its refering to are:

--- START ---

username,year_of_jan,current_in,current_out,current_start,last_update,m''||monthcurr||''_in AS monthin,m''||monthcurr||''_out AS monthout
  FROM customer_stats WHERE username=''''''||username||'''''''';

  OPEN curs FOR EXECUTE str;

--- END ---

str is defined as a varchar(255).  What could be causing str to be NULL
when the execute is caused?  I would have thought if some of the
variables were null that it would have complained about a malformed SQL
query but this is saying the string is NULL!

any ideas help much appreciated, thanks.

Graeme Hinchliffe (BSc)
Core Internet Systems Designer
Zen Internet (

Direct: 0845 058 9074
Main  : 0845 058 9000
Fax   : 0845 058 9005


pgsql-general by date

Next:From: Stephan SzaboDate: 2004-09-29 15:06:27
Subject: Re: About PostgreSQL's limit on arithmetic operations
Previous:From: Thomas F.O'ConnellDate: 2004-09-29 13:34:11
Subject: Re: EXTRACT Clarification

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