Skip to content

The sqlpage_files table does not exist #718

Open
@BlueHtml

Description

@BlueHtml

Hello, I used the table component, and the SQL is as follows:

select 
    'table' as component;
select 
    1 as a,
    2 as b;
select 
    3 as a,
    4 as b;

When connecting to the local MSSQL, it works fine. However, when connecting to the MSSQL on the server, it reports an error as follows:

Sorry, but we were not able to process your request. 

Below are detailed debugging information which may contain sensitive data. Set environment to "prod" in the configuration file to hide this information. 

Failed to create a render context from the header context.

Caused by:
    0: The shell component should always exist
    1: Unable to get the component 'shell'
    2: Couldn't load "sqlpage/templates/shell.handlebars" into cache
    3: Unable to read "sqlpage/templates/shell.handlebars" from the database
    4: error returned from database: 对象名 'sqlpage_files' 无效。
    5: 对象名 'sqlpage_files' 无效。

Then I manually created the sqlpage_files table (on the server's MSSQL), and it worked fine. However, the local MSSQL did not require creating this table. What could be the reason for this?

Version information

  • OS: windows 10 Simplified Chinese zh-CN
  • Database: MSSQL 2012
  • SQLPage Version: 0.31.0

Additional context

The console log is as follows:

[2024-11-27T05:50:09.970Z DEBUG sqlpage::webserver::http] Processing SQL request: "ms-table.sql"
[2024-11-27T05:50:09.971Z TRACE sqlpage::file_cache] Attempting to get from cache "ms-table.sql"
[2024-11-27T05:50:09.971Z TRACE sqlpage::file_cache] Loading and parsing "ms-table.sql"
[2024-11-27T05:50:09.972Z DEBUG sqlpage::filesystem] Reading file "ms-table.sql" from "D:\\code\\codeup\\sqlpage\\m2\\ms-table.sql"
[2024-11-27T05:50:09.972Z TRACE actix_http::h1::dispatcher] end timers:
[2024-11-27T05:50:09.973Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-11-27T05:50:09.973Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-11-27T05:50:09.974Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-11-27T05:50:09.974Z TRACE actix_http::h1::dispatcher] end flags: Flags(STARTED)
[2024-11-27T05:50:09.979Z TRACE actix_http::h1::dispatcher] start flags: Flags(STARTED)
[2024-11-27T05:50:09.979Z TRACE actix_http::h1::dispatcher] start timers:
[2024-11-27T05:50:09.980Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-11-27T05:50:09.981Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-11-27T05:50:09.981Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-11-27T05:50:09.982Z DEBUG sqlpage::webserver::database::sql] Parsing SQL file "ms-table.sql"
[2024-11-27T05:50:09.982Z TRACE sqlpage::webserver::database::sql] Parsing SQL: select
        'table' as component;
    select
        1 as a,
        2 as b;
    select
        3 as a,
        4 as b;
[2024-11-27T05:50:09.983Z DEBUG sqlparser::parser] parsing expr
[2024-11-27T05:50:09.984Z DEBUG sqlparser::parser] prefix: Value(SingleQuotedString("table"))
[2024-11-27T05:50:09.984Z DEBUG sqlparser::dialect] get_next_precedence_full() TokenWithLocation { token: Word(Word { value: "as", quote_style: None, keyword: AS }), location: Location { line: 2, column: 13 } }
[2024-11-27T05:50:09.985Z DEBUG sqlparser::parser] next precedence: 0
[2024-11-27T05:50:09.985Z DEBUG sqlpage::webserver::database::sql] Parsed statement: SELECT 'table' AS component
[2024-11-27T05:50:09.986Z DEBUG sqlpage::webserver::database::sql] Optimised a static simple select to avoid a trivial database query: SELECT 'table' AS component optimized to [("component", Static(String("table")))]
[2024-11-27T05:50:09.986Z DEBUG sqlparser::parser] parsing expr
[2024-11-27T05:50:09.987Z DEBUG sqlparser::parser] prefix: Value(Number("1", false))
[2024-11-27T05:50:09.988Z DEBUG sqlparser::dialect] get_next_precedence_full() TokenWithLocation { token: Word(Word { value: "as", quote_style: None, keyword: AS }), location: Location { line: 4, column: 7 } }
[2024-11-27T05:50:09.988Z DEBUG sqlparser::parser] next precedence: 0
[2024-11-27T05:50:09.989Z DEBUG sqlparser::parser] parsing expr
[2024-11-27T05:50:09.989Z DEBUG sqlparser::parser] prefix: Value(Number("2", false))
[2024-11-27T05:50:09.990Z DEBUG sqlparser::dialect] get_next_precedence_full() TokenWithLocation { token: Word(Word { value: "as", quote_style: None, keyword: AS }), location: Location { line: 5, column: 7 } }
[2024-11-27T05:50:09.994Z DEBUG sqlparser::parser] next precedence: 0
[2024-11-27T05:50:09.995Z DEBUG sqlpage::webserver::database::sql] Parsed statement: SELECT 1 AS a, 2 AS b
[2024-11-27T05:50:09.996Z DEBUG sqlpage::webserver::database::sql] Optimised a static simple select to avoid a trivial database query: SELECT 1 AS a, 2 AS b optimized to [("a", Static(Number(1))), ("b", Static(Number(2)))]
[2024-11-27T05:50:09.996Z DEBUG sqlparser::parser] parsing expr
[2024-11-27T05:50:09.997Z DEBUG sqlparser::parser] prefix: Value(Number("3", false))
[2024-11-27T05:50:09.997Z DEBUG sqlparser::dialect] get_next_precedence_full() TokenWithLocation { token: Word(Word { value: "as", quote_style: None, keyword: AS }), location: Location { line: 7, column: 7 } }
[2024-11-27T05:50:09.998Z DEBUG sqlparser::parser] next precedence: 0
[2024-11-27T05:50:09.998Z DEBUG sqlparser::parser] parsing expr
[2024-11-27T05:50:09.999Z DEBUG sqlparser::parser] prefix: Value(Number("4", false))
[2024-11-27T05:50:09.999Z DEBUG sqlparser::dialect] get_next_precedence_full() TokenWithLocation { token: Word(Word { value: "as", quote_style: None, keyword: AS }), location: Location { line: 8, column: 7 } }
[2024-11-27T05:50:10.000Z DEBUG sqlparser::parser] next precedence: 0
[2024-11-27T05:50:10.000Z DEBUG sqlpage::webserver::database::sql] Parsed statement: SELECT 3 AS a, 4 AS b
[2024-11-27T05:50:10.001Z DEBUG sqlpage::webserver::database::sql] Optimised a static simple select to avoid a trivial database query: SELECT 3 AS a, 4 AS b optimized to [("a", Static(Number(3))), ("b", Static(Number(4)))]
[2024-11-27T05:50:10.002Z TRACE sqlpage::file_cache] Writing to cache "ms-table.sql"
[2024-11-27T05:50:10.002Z TRACE sqlpage::file_cache] Done writing to cache "ms-table.sql"
[2024-11-27T05:50:10.003Z TRACE sqlpage::file_cache] "ms-table.sql" loaded in cache
[2024-11-27T05:50:10.003Z DEBUG sqlpage::webserver::http_request_info] Not parsing POST data from request without known content type
[2024-11-27T05:50:10.005Z TRACE actix_http::h1::dispatcher] end timers:
[2024-11-27T05:50:10.009Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-11-27T05:50:10.010Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-11-27T05:50:10.011Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-11-27T05:50:10.011Z TRACE actix_http::h1::dispatcher] end flags: Flags(STARTED)
[2024-11-27T05:50:10.012Z DEBUG sqlpage::render] Handling header row: {"component":"table"}
[2024-11-27T05:50:10.012Z DEBUG sqlpage::render] Creating the shell component for the page
[2024-11-27T05:50:10.013Z TRACE sqlpage::render] No shell component found in the first row. Adding the default shell: {"component":"shell"}
[2024-11-27T05:50:10.014Z TRACE sqlpage::file_cache] Attempting to get from cache "sqlpage/templates/shell.handlebars"
[2024-11-27T05:50:10.014Z TRACE sqlpage::file_cache] Loading and parsing "sqlpage/templates/shell.handlebars"
[2024-11-27T05:50:10.015Z TRACE sqlpage::filesystem] Normalizing template path "sqlpage/templates/shell.handlebars" to "\\\\?\\D:\\code\\codeup\\sqlpage\\m2\\sqlpage\\templates\\shell.handlebars"
[2024-11-27T05:50:10.015Z DEBUG sqlpage::filesystem] Reading file "sqlpage/templates/shell.handlebars" from "\\\\?\\D:\\code\\codeup\\sqlpage\\m2\\sqlpage\\templates\\shell.handlebars"
[2024-11-27T05:50:10.016Z DEBUG sqlpage::filesystem] Reading file sqlpage/templates/shell.handlebars from the database
[2024-11-27T05:50:10.039Z TRACE sqlx::query] /* SQLx ping */; rows affected: 0, rows returned: 0, elapsed: 22.213ms
[2024-11-27T05:50:10.060Z TRACE sqlx::query] SELECT contents from sqlpage_files …; rows affected: 0, rows returned: 0, elapsed: 21.091ms

    SELECT
      contents
    from
      sqlpage_files
    WHERE
      path = @p1

[2024-11-27T05:50:10.061Z TRACE sqlpage::file_cache] Evicting "sqlpage/templates/shell.handlebars" from the cache because the following error occurred: Couldn't load "sqlpage/templates/shell.handlebars" into cache
[2024-11-27T05:50:10.062Z TRACE sqlpage::file_cache] Removing from cache "sqlpage/templates/shell.handlebars"
[2024-11-27T05:50:10.063Z TRACE sqlpage::file_cache] Done removing from cache "sqlpage/templates/shell.handlebars"
[2024-11-27T05:50:10.063Z ERROR sqlpage::webserver::http] An error occurred before starting to send the response body: Failed to create a render context from the header context.: The shell component should always exist: Unable to get the component 'shell': Couldn't load "sqlpage/templates/shell.handlebars" into cache: Unable to read "sqlpage/templates/shell.handlebars" from the database: error returned from database: 对象名 'sqlpage_files' 无效。: 对象名 'sqlpage_files' 无效 。
[2024-11-27T05:50:10.064Z TRACE actix_http::h1::dispatcher] start flags: Flags(STARTED)
[2024-11-27T05:50:10.065Z TRACE actix_http::h1::dispatcher] start timers:
[2024-11-27T05:50:10.065Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-11-27T05:50:10.066Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-11-27T05:50:10.066Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-11-27T05:50:10.067Z INFO  actix_web::middleware::logger] 127.0.0.1 "GET /ms-table.sql HTTP/1.1" 500 632 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36" 0.096701
[2024-11-27T05:50:10.067Z TRACE actix_http::h1::dispatcher] end timers:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions