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

Anonymous code blocks don't work #1585

Open
5 of 7 tasks
ffried opened this issue May 29, 2024 · 1 comment
Open
5 of 7 tasks

Anonymous code blocks don't work #1585

ffried opened this issue May 29, 2024 · 1 comment

Comments

@ffried
Copy link

ffried commented May 29, 2024

  • pgloader --version

    pgloader version "3.6.7~devel"
    compiled with SBCL 2.1.1.debian
    
  • did you test a fresh compile from the source tree?
    Unfortunately I can't, because building on an ARM Mac does not seem to be supported.
    Installing clozure-cl already fails with: clozure-cl: The x86_64 architecture is required for this software.

    Using a docker build worked, but produces the same result.

  • did you search for other similar issues?

  • how can I reproduce the bug?

    Incude a self-contained pgloader command file.

    If you're loading from a database, consider attaching a database dump to
    your issue. For MySQL, use mysqldump. For SQLite, just send over your
    source file, that's easy. Maybe be the one with your production data, of
    course, the one with just the sample of data that allows me to reproduce
    your bug.

    When using a proprietary database system as a source, consider creating
    a sample database on some Cloud service or somewhere you can then give
    me access to, and see my email address on my GitHub profile to send me
    the credentials. Still open a public issue for tracking and as
    documentation for other users.

LOAD CSV
     FROM INLINE with encoding 'ascii'
     INTO postgresql:https:///pgloader
     TARGET TABLE jordane

     WITH truncate,
          fields terminated by '|',
          fields not enclosed,
          fields escaped by backslash-quote

      SET work_mem to '128MB',
          standard_conforming_strings to 'on'

   BEFORE LOAD DO
    $$ drop table if exists jordane; $$,
    $$ CREATE TABLE jordane
       (
         "NOM" character(20),
         "PRENOM" character(20)
       )
    $$
    AFTER LOAD EXECUTE 'my_script.sql';

BORDET|Jordane
BORDET|Audrey
LASTNAME|"opening quote
BONNIER|testprenombe~aucouptroplong
JOURDAIN|héhé¶

Contents of my_script.sql:

DO $$
BEGIN
EXECUTE 'select 1;';
END;
$$;
  • pgloader output you obtain
2024-05-29T10:58:36.049000Z LOG pgloader version "3.6.7~devel"
2024-05-29T10:58:36.054000Z LOG Parsing commands from file #P"/work/DBMigrate.load"
KABOOM!
END-OF-FILE: end of file on #<dynamic-extent STRING-INPUT-STREAM (unavailable) from "DO $$
BE...">
An unhandled error condition has been signalled:
   end of file on #<dynamic-extent STRING-INPUT-STREAM (unavailable) from "DO $$
BE...">




What I am doing here?

end of file on #<dynamic-extent STRING-INPUT-STREAM (unavailable) from "DO $$
BE...">
  • data that is being loaded, if relevant

  • How the data is different from what you expected, if relevant

@ffried
Copy link
Author

ffried commented May 31, 2024

I just noticed, that the DO block isn't the problem. It seems the EXECUTE is the actual trigger here.
I'm not sure what exactly the underlying issue is, but #945 fixes it!

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

No branches or pull requests

1 participant