Motion - Bug Report 2012x 12x 12x 205638

BUG: trunkREV557: motion does not insert data to a postgresql db.

Update: i just found the the bug and fixed.

In motion.h there was that:

#define DEF_SQL_QUERY "sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')"

i removed "sql_query" from the exact insert sql query string.

So basically typo fixed and everything is working fine now.


Motion does not insert data to a postgresql db. I get the misleading error. I tried to insert manually the query used by motion (from debug output) and it was successfully inserted into db.

The error is even very misleading: "<...> failed: Success".

The full details, configuration, motion config and error log are attached.

Thanks

###OS

root@tree:~# lsb_release -a
LSB Version:   core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:   Ubuntu
Description:   Ubuntu 12.04.1 LTS
Release:   12.04
Codename:   precise

###Postgresql

postgresql-9.2.1

###Motion

svn co http://www.lavrsen.dk/svn/motion/trunk trunk
Checked out revision 557.

./configure --prefix=/usr/local/motion --with-ffmpeg=/usr/lib/x86_64-linux-gnu --with-ffmpeg-headers=/usr/include/x86_64-linux-gnu --with-pgsql-lib=/usr/local/pgsql/lib --with-pgsql-include=/usr/local/pgsql/include --without-sqlite3 --without-mysql

   **************************
      Configure status       
      motion trunkREV557
   **************************

OS             :     Linux
pthread support:     Yes
jpeg support:        Yes
V4L support:         Yes
V4L2 support:        Yes
SDL support:         Yes
FFmpeg support:      Yes
SQLite3 support:     No
MYSQL support:       No
PostgreSQL support:  Yes

### motion table created
CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp without time zone, eve
nt_time_stamp char(40));

###run motion
./motion -c ../etc/motion.conf

###ERROR LOG
[0] [NTC] [ALL] [Dec 13 10:12:25] motion_startup: Using log type (DBL) log level (ALL)
[1] [NTC] [DBL] [Dec 13 10:12:25] motion_init: Database backend postgresql
[1] [ERR] [DBL] [Dec 13 10:12:41] event_sqlnewfile: PGSQL query [sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values(&#39;1&#39;, &#39;/usr/local/motion/output/01-20121213101241.avi&#39;, &#39;00&#39;, &#39;8&#39;, &#39;2012-12-13 10:12:41&#39;, &#39;20121213101241&#39;)] failed: Success
[1] [ERR] [DBL] [Dec 13 10:12:41] event_sqlnewfile: PGSQL query [sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values(&#39;1&#39;, &#39;/usr/local/motion/output/01-20121213101241-00.jpg&#39;, &#39;00&#39;, &#39;1&#39;, &#39;2012-12-13 10:12:41&#39;, &#39;20121213101241&#39;)] failed: Success
[1] [ERR] [DBL] [Dec 13 10:12:41] event_sqlnewfile: PGSQL query [sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values(&#39;1&#39;, &#39;/usr/local/motion/output/01-20121213101241-01.jpg&#39;, &#39;01&#39;, &#39;1&#39;, &#39;2012-12-13 10:12:41&#39;, &#39;20121213101241&#39;)] failed: Success
[1] [ERR] [DBL] [Dec 13 10:12:42] event_sqlnewfile: PGSQL query [sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values(&#39;1&#39;, &#39;/usr/local/motion/output/01-20121213101242-00.jpg&#39;, &#39;00&#39;, &#39;1&#39;, &#39;2012-12-13 10:12:42&#39;, &#39;20121213101241&#39;)] failed: Success
[1] [ERR] [DBL] [Dec 13 10:12:42] event_sqlnewfile: PGSQL query [sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values(&#39;1&#39;, &#39;/usr/local/motion/output/01-20121213101242-01.jpg&#39;, &#39;01&#39;, &#39;1&#39;, &#39;2012-12-13 10:12:42&#39;, &#39;20121213101241&#39;)] failed: Success

### db options in motion.conf

############################################################
# Database Options
############################################################

# database type : mysql, postgresql, sqlite3 (default : not defined)
; database_type value

database_type postgresql

# database to log to (default: not defined)
; database_dbname value

database_dbname motion

# The host on which the database is located (default: localhost)
; database_host value

database_host localhost

# User account name for database (default: not defined)
; database_user value

database_user pgsql

# User password for database (default: not defined)
; database_password value

# Port on which the database is located
#  mysql 3306 , postgresql 5432 (default: not defined)
; database_port value

database_port 5432




Environment

Motion version: trunkREV557
ffmpeg version:  
Shared libraries: ffmpeg, postgresql
Server OS: Ubuntu 12.04.1 LTS amd64, kernel 3.2.0-33-generic
-- KarolisE - 13 Dec 2012

Follow up

Fix record

BugReportForm edit

TopicTitle trunkREV557: motion does not insert data to a postgresql db.
BugStatus Resolved
AssignedBugTo
SubmittedBy KarolisE
Topic revision: r2 - 13 Dec 2012, KarolisE
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.