[SQL] UNIT-tests and SQL

2005-07-01 Thread KÖPFERL Robert
What's your experience concerning unit tests for stored procedures on
postgres?

I'd expect to write wrappers for any *unit - programming language and use
its *unit variant to do the actual testing.
>From my feeling SQLunit is kind of too xml-ish and I'm not sure wheter I can
save the output of some fcn to use it as input for fcn A and B.

Yeah, what're you doin?

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[SQL] SQLCloseCursor() or SQLFreeStmt does not free memory allcated to read CLOB field in Oracle.

2005-07-01 Thread Vadivel Subramaniam
   
 Hi,   
   
 This is query realated to ODBC and CLOB field in Oracle. I feel some of
 you might have faced similar issue.  Any hint would help me.  
   
   
 I am using a C++ application that connects to Oracle Database using   
 EasySoft ODBC driver. I face a strange problem when freeing the memory
 after i fetch the CLOB data from the Oracle table.
   
   
 The piece of Code is below,   
   
   
    char *pClobBuffer = new char[10485670];  // 10 MB  
   
   
   // Prepare the SQL statement    strcpy(pQuery, "SELECT clobdata FROM
 clobtable")   
   
   
    /* Execute the SQL statement. Check for errors.
 */    SQLExecDirect(stmtHandle,(SQLC­­HAR*)pQuery,SQL_NTS);    SQLFetch(st
 mtHandle);    SQLGetData(stmtHandle, 1, SQL_C_CHAR, clobBuffer,
 10485670,&dError);    SQLCloseCursor(stmtHandle);    delete []pClobBuffer;
   
   
 The statement and connection handles are closed properly. Still i am  
 seeing the memory usage is exactly increasing by 10 MB(size of the buffer
 we allocated to read the CLOB) for each query.
   
   
 This is not a memory leak, it's only the memory usage which is increasing
 for the process for every query involving this CLOB field.
   
   
 I tried changing the CLOB to Varchar in the database table, the above 
 piece of Code works without increase in memory usage. 
   
   
 NOTE:  We observed there is some special handling required to free the
 memory buffer allocated to read the CLOB field.  In DB2 site they are
 saying SQLFreeStmt does not free the CLOB fields, FREE Alocator statement
 must be used. 
   
   
 Please suggest me if any special handling is required for ORACLE to free
 the CLOB data.
   
   
 Our Env:  C++, Solaris, ODBC, ORACLE, EasySoft driver   
   
   
 thanks,   
 Vadivel.  
   








***  FSS-Private   ***
"DISCLAIMER: This message is proprietary to Flextronics Software Systems
Limited (FSS) and is intended solely for the use of the
individual to whom it is addressed. It may contain  privileged or
confidential information and should not be circulated or used for
any purpose other than for what it is intended. If you have received this
message in  error, please notify the originator immediately.
If you are not the intended recipient, you are notified that you are
strictly  prohibited  from  using, copying, altering, or disclosing
the contents of this message.  FSS  accepts no  responsibility  for loss or
damage arising from the use of  the information transmitted
by this email including damage from virus."


---(end of broadcast)---
TIP 8: explain analyze is your f

[SQL] 'show full processlist' in postgres?

2005-07-01 Thread Erik Wasser
Hallo pgsql-sql@postgresql.org,

I'm looking for a way to display the active querys of postgres. The 
mysql way is a 'show [full] processlist'.

After I've read http://pgsqld.active-venture.com/monitoring-stats.html I 
set STATS_COMMAND_STRING, STATS_BLOCK_LEVEL, STATS_ROW_LEVEL and 
STATS_START_COLLECTOR to 'true'.

Then I executed the query from the bottom of the page:

> SELECT pg_stat_get_backend_pid(S.backendid) AS procpid,
>pg_stat_get_backend_activity(S.backendid) AS current_query
>FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS S;

The result was:

 procpid | current_query
-+---
1367 |
   27387 |
 930 |
   28425 | 
(4 rows)

Why there isn't any query in the 'current_query' row? Calling the query 
multiple times just changes the PID (sometimes) but 'current_query' was 
always empty. How do I show up the a list of querys that will be 
processed right in this moment?

P.S: I'm using postgresql 7.4.7 and I was logged I as 'postgres'.

-- 
So long... Fuzz

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[SQL] Some help please

2005-07-01 Thread Nick Stone
Hi,

I'm interested in using the connectby() function which I gather from the
lists can be used in a similar way to the Oracle connect by ... PRIOR
functionality. Does anybody know where there's an example of this in use or
better still could somebody post an example.

Many thanks

Nick



---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [SQL] 'show full processlist' in postgres?

2005-07-01 Thread Jim Buttafuoco
did you restart postgresql and use the pg_stat_activity view instead (just to 
save some typing).

Jim



-- Original Message ---
From: Erik Wasser <[EMAIL PROTECTED]>
To: pgsql-sql@postgresql.org
Sent: Fri, 1 Jul 2005 15:58:46 +0200
Subject: [SQL] 'show full processlist' in postgres?

> Hallo pgsql-sql@postgresql.org,
> 
> I'm looking for a way to display the active querys of postgres. The 
> mysql way is a 'show [full] processlist'.
> 
> After I've read http://pgsqld.active-venture.com/monitoring-stats.html I 
> set STATS_COMMAND_STRING, STATS_BLOCK_LEVEL, STATS_ROW_LEVEL and 
> STATS_START_COLLECTOR to 'true'.
> 
> Then I executed the query from the bottom of the page:
> 
> > SELECT pg_stat_get_backend_pid(S.backendid) AS procpid,
> >pg_stat_get_backend_activity(S.backendid) AS current_query
> >FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS S;
> 
> The result was:
> 
>  procpid | current_query
> -+---
> 1367 |
>27387 |
>  930 |
>28425 | 
> (4 rows)
> 
> Why there isn't any query in the 'current_query' row? Calling the query 
> multiple times just changes the PID (sometimes) but 'current_query' was 
> always empty. How do I show up the a list of querys that will be 
> processed right in this moment?
> 
> P.S: I'm using postgresql 7.4.7 and I was logged I as 'postgres'.
> 
> -- 
> So long... Fuzz
> 
> ---(end of broadcast)---
> TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
--- End of Original Message ---


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] 'show full processlist' in postgres?

2005-07-01 Thread Erik Wasser
On Friday 01 July 2005 18:24, Jim Buttafuoco wrote:

> did you restart postgresql and use the pg_stat_activity view instead
> (just to save some typing).

No. Is a restart necessary or will a 'reload' do also the trick?

I've done the restart:

postgres=#  SELECT * from pg_stat_activity ;
  datid  |  datname  | procpid | usesysid |  usename  | current_query | 
query_start
-+---+-+--+---+---+-
 7349453 | admintool |5436 |  100 | admintool |   |
 7349454 | postgres  |5437 |1 | postgres  |   |
(2 rows)

But 'current_query' is still always empty... B-(

-- 
So long... Fuzz

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] Some help please

2005-07-01 Thread Josh Berkus
Nick,

> I'm interested in using the connectby() function which I gather from the
> lists can be used in a similar way to the Oracle connect by ... PRIOR
> functionality. Does anybody know where there's an example of this in use
> or better still could somebody post an example.

Examples are in the /contrib directory where the connectby source is:
/contrib/tablefunc/README.tablefunc

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] Some help please

2005-07-01 Thread Nick Stone
That's great - thanks very much

Nick 

-Original Message-
From: Josh Berkus [mailto:[EMAIL PROTECTED] 
Sent: 01 July 2005 18:30
To: Nick Stone
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Some help please

Nick,

> I'm interested in using the connectby() function which I gather from 
> the lists can be used in a similar way to the Oracle connect by ... 
> PRIOR functionality. Does anybody know where there's an example of 
> this in use or better still could somebody post an example.

Examples are in the /contrib directory where the connectby source is:
/contrib/tablefunc/README.tablefunc

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco




---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] 'show full processlist' in postgres?

2005-07-01 Thread Tom Lane
Erik Wasser <[EMAIL PROTECTED]> writes:
> But 'current_query' is still always empty... B-(

The pg_stats views lag reality by a certain amount, so checking for your
own query is generally not gonna work.  Try starting a long-running
query in another session.

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [despammed] Re: [SQL] 'show full processlist' in postgres?

2005-07-01 Thread Andreas Kretschmer
am  01.07.2005, um 19:13:36 +0200 mailte Erik Wasser folgendes:
> postgres=#  SELECT * from pg_stat_activity ;
>   datid  |  datname  | procpid | usesysid |  usename  | current_query | 
> query_start
> -+---+-+--+---+---+-
>  7349453 | admintool |5436 |  100 | admintool |   |
>  7349454 | postgres  |5437 |1 | postgres  |   |
> (2 rows)
> 
> But 'current_query' is still always empty... B-(

enable stats_command_string in your postgresql.conf


Regards, Andreas
-- 
Andreas Kretschmer(Kontakt: siehe Header)
Heynitz:  035242/47212,  D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===Schollglas Unternehmensgruppe=== 

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]