Get COUNT() of rows from a table

90 views
Skip to first unread message

Gagneet Singh

unread,
Dec 13, 2015, 11:00:30 PM12/13/15
to dbfit
Hi,

I am using the following query to run a COUNT() on a table:

!|dbfit.PostgresTest|
!|Connect|sgd001.awsnet.com:3333|db_user|password|sdg001|

|query|select schema postgres|
|store query|select a.count(*) from postgres_tbl a|postgres_result|

!|query|<<postgres_result|
|count|

Is there something that I am doing wrong? As I get the following error. I have tried the following:
  • remove a. & a from the STORE QUERY row
  • Use QUERY, instead of STORE QUERY
  • Running it with a basic test, it connects to the DB, no errors.



Error for the above query:

dbfit.PostgresTest

 

Connect

sgd001.awsnet.com:5555

db_user

password

sdg001

Query

select schema sor

Store Query

select a.count(*) from postgres_tbl a

postgres_result

 

query

java.lang.UnsupportedOperationException: Stored queries can only be used on symbols that contain result sets

        at dbfit.fixture.Query.getFromSymbol(Query.java:59)

        at dbfit.fixture.Query.getDataTable(Query.java:39)

        at dbfit.fixture.RowSetFixture.doRows(RowSetFixture.java:92)

        at fit.Fixture.doTable(Fixture.java:156)

        at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)

        at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)

        at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)

        at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)

        at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)

        at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)

        at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)

        at fit.Fixture.doTables(Fixture.java:81)

        at fit.FitServer.process(FitServer.java:81)

        at fit.FitServer.run(FitServer.java:56)

        at fit.FitServer.main(FitServer.java:41)

<<netezzatbl

count



Can I get to know what I am doing wrong and what needs to be done to correct the above and get a single result set for a ROW COUNT query?


Thank You.

Regards,
Gagneet

Yavor Nikolov

unread,
Dec 14, 2015, 12:02:57 PM12/14/15
to db...@googlegroups.com
!|Store Query|select count(*) as my_count from postgres_tbl|postgres_result|

!|Query|<<postgres_result|
|my_count|

If you need to change the schema - maybe before that you need something like |Execute|set schema 'postgres'| (or use custom connection url http://stackoverflow.com/questions/4168689/is-it-possible-to-specify-schema-when-connecting-to-postgres-with-jdbc).

--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+un...@googlegroups.com.
To post to this group, send email to db...@googlegroups.com.
Visit this group at https://groups.google.com/group/dbfit.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages