From sdavis2 at mail.nih.gov  Tue Feb 20 20:02:15 2007
From: sdavis2 at mail.nih.gov (Sean Davis)
Date: Tue, 20 Feb 2007 14:02:15 -0500
Subject: [Rd] RODBC problems with unixodbc
In-Reply-To: <87mz38mzlq.fsf@patagonia.sebmags.homelinux.org>
References: <87mz38mzlq.fsf@patagonia.sebmags.homelinux.org>
Message-ID: <200702201402.15985.sdavis2@mail.nih.gov>

On Tuesday 20 February 2007 13:51, Sebastian P. Luque wrote:
> Hi,
>
> I noticed that if a column is named "end" in a data frame (table.df
> below), it leads to errors when trying to sqlSave()'it to a postgresql
> connection:
>
>
> ---<---------------cut here---------------start-------------->---
> con <- odbcConnect("PostgreSQL-DB", uid="user", pwd="password",
>                    case="postgresql")
> R> sqlSave(con, table.df)
> Error in sqlSave(con, table.df) :
> 	[RODBC] ERROR: Could not SQLExecDirect
> 42601 7 [unixODBC]Error while executing the query;
> ERROR:  syntax error at or near "end" at character 140
> ---<---------------cut here---------------end---------------->---
>
>
> If I rename the column to something else (e.g. "ending"), this proceeds
> without problems.  What could the problem be here?  Thanks.

"end" is a reserved word in postgresql.  See here:

http://www.postgresql.org/docs/8.2/static/sql-keywords-appendix.html

This doesn't have anything to do with RODBC or unixODBC, I don't think.

Sean



[Rd] RODBC problems with unixodbc
Sean Davis