Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Invalid object name #41

Closed
matthewjenkins opened this issue Sep 12, 2018 · 3 comments
Closed

Invalid object name #41

matthewjenkins opened this issue Sep 12, 2018 · 3 comments
Labels

Comments

@matthewjenkins
Copy link

Type

What kind of issue is this?

[x] Bug report.
[ ] Feature request.

Current Behavior

When running ssc pull [name] I run into an error due to the naming convention of some of the objects in a database.

Expected behavior

I would expect this to work on anything that is a valid object name in sql

Steps to Reproduce

SQL:

CREATE TABLE dbo.[v999ZipCode<>5]
( Id INT IDENTITY(1, 1) )

then run ssc via ssc pull [connectionname]

Other Information

Error Dump

c:\Projects\[Project Name]>ssc pull [ConnectionName]
Pulling [ConnectionName] from [ServerName] ...
tedious deprecated The default value for `options.encrypt` will change from `false` to `true`. Please pass `false` explicitly if you want to retain current beha
viour. ..\..\Users\[Node Module Location]\sql-source-control\node_modules\mssql\lib\tedious.js:230:23
{ RequestError: Invalid object name 'dbo.v999ZipCode<>5'.
    at handleError ([Node Module Location]\mssql\lib\tedious.js:546:15)
    at emitOne (events.js:116:13)
    at Connection.emit (events.js:211:7)
    at Parser.<anonymous> ([Node Module Location]\sql-source-control\node_modules\tedious\lib\connection.js:611:16)
    at emitOne (events.js:116:13)
    at Parser.emit (events.js:211:7)
    at Parser.<anonymous> ([Node Module Location]\sql-source-control\node_modules\tedious\lib\token\token-stream-parser.js:54:15)
    at emitOne (events.js:116:13)
    at Parser.emit (events.js:211:7)
    at addChunk ([Node Module Location]\sql-source-control\node_modules\readable-stream\lib\_stream_readable.js:291:12)
  code: 'EREQUEST',
  number: 208,
  lineNumber: 1,
  state: 1,
  class: 16,
  serverName: '[ServerName]',
  procName: '',
  originalError:
   { Error: Invalid object name 'dbo.v999ZipCode<>5'.
    at handleError ([Node Module Location]\sql-source-control\node_modules\mssql\lib\tedious.js:544:19)
    at emitOne (events.js:116:13)
    at Connection.emit (events.js:211:7)
    at Parser.<anonymous> ([Node Module Location]\sql-source-control\node_modules\tedious\lib\connection.js:611:16)
    at emitOne (events.js:116:13)
    at Parser.emit (events.js:211:7)
    at Parser.<anonymous> ([Node Module Location]\sql-source-control\node_modules\tedious\lib\token\token-stream-parser.js:54:15)
    at emitOne (events.js:116:13)
    at Parser.emit (events.js:211:7)
    at addChunk ([Node Module Location]\sql-source-control\node_modules\readable-stream\lib\_stream_readable.js:291:12)
     info:
      { number: 208,
        state: 1,
        class: 16,
        message: 'Invalid object name \'dbo.v999ZipCode<>5\'.',
        serverName: '[ServerName]',
        procName: '',
        lineNumber: 1,
        name: 'ERROR',
        event: 'errorMessage' } },
  name: 'RequestError',
  precedingErrors: [] }
@justinlettau
Copy link
Owner

Hey @terminalsamurai, I tried your example and got an error, but not the same error have listed above. Can you post your config and the full command your running?

The error I got was related to creating a file (dbo.v999ZipCode<>5.sql) on Windows where the name contains special invalid characters. Are you running WIndows?

@matthewjenkins
Copy link
Author

matthewjenkins commented Sep 15, 2018

Running windows10 here.

Command run: ssc pull dev

After updating ssc to latest 1.9.1 (from 1.9.0 I believe) the error is now different:

Creating _sql-database\views\dbo.v999ZipCode<>5.sql ...
{ Error: ENOENT: no such file or directory, open '[project dir]\_sql-database\views\dbo.v999ZipCode<>5.sql'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at Object.outputFileSync ([Node]\fs-extra\lib\output\index.js:31:15)
    at createFile ([Node]\sql-source-control\dist\commands\pull.js:186:12)
    at [Node]\sql-source-control\dist\commands\pull.js:90:19
    at Array.forEach (<anonymous>)
    at scriptFiles ([Node]\sql-source-control\dist\commands\pull.js:85:13)
    at [Node]\sql-source-control\dist\commands\pull.js:44:43
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: '[project dir]\\_sql-database\\views\\dbo.v999ZipCode<>5.sql' }

My ssc.json is the following:

{
  "connections": [
    {
      "name": "dev",
      "server": "SERVERNAME",
      "database": "DATABASE",
      "port": 1433,
      "user": "USER",
      "password": "PASSWORD"
    }
  ]
}

Let me know if I'm missing anything here.

@justinlettau
Copy link
Owner

Thanks. That looks like the same error I saw. Will need to add support to remove special characters before saving files. Thanks.

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

No branches or pull requests

2 participants