Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error when creating an index #287

Closed
gavinwahl opened this issue Sep 1, 2015 · 5 comments
Closed

Syntax error when creating an index #287

gavinwahl opened this issue Sep 1, 2015 · 5 comments

Comments

@gavinwahl
Copy link
Contributor

I think maybe the index name should be quoted?

2015-09-01T21:11:58.587000Z ERROR Database error 42601: syntax error at or near "City"
QUERY: CREATE INDEX idx_17973_Foo City ON dbo.foo (city);
@dimitri
Copy link
Owner

dimitri commented Sep 2, 2015

Hi, I need more information to be able to help you here. What version of pgloader are you using (pgloader --version), and against with database source (dbo looks like MS SQL, but well, that's only a hint here).

@gavinwahl
Copy link
Contributor Author

Running from source, commit b78bb6d. It's ms sql.

dimitri added a commit that referenced this issue Sep 3, 2015
As seen in #287 the previous decision to force quoting to :none is
wrong, because index names in MS SQL source database might contain
spaces, and then need to be quoted.

Let's see what happens if we do it the usual way for MS SQL too, and
allow users to control the quoting behaviour of pgloader here.
@dimitri
Copy link
Owner

dimitri commented Sep 3, 2015

So I just added what I think should fix the problem, with an option for you to control pgloader's behavior. In the WITH clause you may now use either quote identifiers or downcase identifiers and have the same processing as in the MySQL case here (which is documented). The default is to downcase and you might want to quote instead. In case of failure please try both options and report back.

Should you confirm it works with that change, I will then cover that in the documentations and close the issue. Thanks for reporting this bug!

dimitri added a commit that referenced this issue Sep 3, 2015
When parsing table names in the target URI, we are careful of splitting
the table and schema name and store them into a cons in that case. Not
all sources methods got the memo, clean that up.

See #182 and #186, a pull request I am now going to be able to accept.
Also see #287 that should be helped by being able to apply #186.
@dimitri
Copy link
Owner

dimitri commented Sep 3, 2015

See also #186 that has been now properly merged into pgloader.

@dimitri dimitri closed this as completed Sep 3, 2015
@dimitri
Copy link
Owner

dimitri commented Sep 3, 2015

Oh oops. Clicked "close" inadvertently. Please re-open if you still have the bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants