<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SQL error: extra parentheses"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=114755">bug 114755</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>lionel@mamane.lu
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SQL error: extra parentheses"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=114755#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SQL error: extra parentheses"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=114755">bug 114755</a>
              from <span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span></b>
        <pre>I retrieved a backtrace from location indicated by console logs and got this:
#0  0x00007fffc4b9610e in connectivity::firebird::StatusVectorToString(long
const (&) [20], rtl::OUString const&) (rStatusVector=...,
rCause="isc_dsql_prepare")
    at
/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Util.cxx:54
#1  0x00007fffc4b962fb in connectivity::firebird::evaluateStatusVector(long
const (&) [20], rtl::OUString const&,
com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
(rStatusVector=..., rCause="isc_dsql_prepare", _rxContext=uno::Reference to
(connectivity::firebird::OStatement *) 0x5555580dea40)
    at
/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Util.cxx:64
#2  0x00007fffc4b8a5c6 in
connectivity::firebird::OStatementCommonBase::prepareAndDescribeStatement(rtl::OUString
const&, XSQLDA*&, XSQLDA*) (this=0x5555580dea40, sql="INSERT INTO \"Table12\" (
\"cardinal\",\"words\" ) ( SELECT \"cardinal\", \"words\" FROM \"Table1\" )",
pOutSqlda=@0x5555580debe0: 0x5555580dcfa0, pInSqlda=0x0)
    at
/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/StatementCommonBase.cxx:163
#3  0x00007fffc4b88f46 in
connectivity::firebird::OStatement::executeQuery(rtl::OUString const&)
(this=0x5555580dea40, sql="INSERT INTO \"Table12\" ( \"cardinal\",\"words\" ) (
SELECT \"cardinal\", \"words\" FROM \"Table1\" )") at
/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Statement.cxx:112
#4  0x00007fffc4b892bb in
connectivity::firebird::OStatement::execute(rtl::OUString const&)
(this=0x5555580dea40, sql="INSERT INTO \"Table12\" ( \"cardinal\",\"words\" ) (
SELECT \"cardinal\", \"words\" FROM \"Table1\" )") at
/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Statement.cxx:148
#5  0x00007fffc4b88dcc in
connectivity::firebird::OStatement::executeUpdate(rtl::OUString const&)
(this=0x5555580dea40, sql="INSERT INTO \"Table12\" ( \"cardinal\",\"words\" ) (
SELECT \"cardinal\", \"words\" FROM \"Table1\" )") at
/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Statement.cxx:96
#6  0x00007fffcae09623 in OStatement::executeUpdate(rtl::OUString const&)
(this=0x5555580ddff0, _rSQL="INSERT INTO \"Table12\" ( \"cardinal\",\"words\" )
( SELECT \"cardinal\", \"words\" FROM \"Table1\" )") at
/home/julien/lo/libreoffice/dbaccess/source/core/api/statement.cxx:478
#7  0x00007fffc835d28e in dbaui::CopyTableWizard::impl_doCopy_nothrow()
(this=0x5555580a3cf0) at
/home/julien/lo/libreoffice/dbaccess/source/ui/uno/copytablewizard.cxx:1368

The request is generated from
CopyTableWizard::impl_getServerSideCopyStatement_throw 
1442 const OUString sComposedTableName = ::dbtools::composeTableName(
xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true );
1443 OUString sSql("INSERT INTO " + sComposedTableName + " ( " +
sColumns.makeStringAndClear() + " ) ( " + m_pSourceObject->getSelectStatement()
+ " )");

see
<a href="https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/uno/copytablewizard.cxx#1425">https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/uno/copytablewizard.cxx#1425</a>

Lionel: here are 2 questions:
1) I haven't found SQL ref about INSERT INTO SELECT but when I read about it on
to <a href="https://www.w3schools.com/sql/sql_insert_into_select.asp">https://www.w3schools.com/sql/sql_insert_into_select.asp</a> or on other
websites, I never see parenthesis around SELECT block.
Do you think it'd be ok to remove them?

2) Now about the table used for INSERT block, the sql can't succeed since the
new table doesn't exist yet at this moment.
However, if we use the same table as the SELECT block, it won't work as soon as
there's primary/unique index.
Any thoughts?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>