Coder Social home page Coder Social logo

Comments (5)

imor avatar imor commented on June 22, 2024 4

Okay this is a pg_tle bug. You can reproduce it by running the following pgtle api calls:

-- install version 1.0 of an extension
SELECT pgtle.install_extension
(
 'test123',
 '1.0',
 'Test TLE Functions',
$_pgtle_$
  CREATE OR REPLACE FUNCTION test123_func()
  RETURNS INT AS $$
  (
    SELECT 10
  )$$ LANGUAGE sql;
$_pgtle_$
);

-- create update path to 1.1
SELECT pgtle.install_update_path
(
 'test123',
 '1.0',
 '1.1',
$_pgtle_$
  CREATE OR REPLACE FUNCTION test123_func()
  RETURNS INT AS $$
  (
    SELECT 11
  )$$ LANGUAGE sql;
$_pgtle_$
);

--confirm that the upgrade paths are registered
select * from pgtle.extension_update_paths('test123');

-- create extension should pass but it fails with the error:
-- ERROR:  could not find sql function "test123--1.1.sql" for extension test123 in schema pgtle 
-- 
-- SQL state: XX000
CREATE EXTENSION test123 version '1.1';

I couldn't reproduce it earlier because I was on the latest dev version of pg_tle. We plan to update pg_tle to the latest version on our platform soon but until then dbdev TLEs will have to use a test123--1.1.sql file as well. If you have published a basejump-basejump_core without the basejump-basejump_core--2.0.1.sql, just add this file and run dbdev publish again and that should fix it.

from dbdev.

imor avatar imor commented on June 22, 2024

Hey @tiniscule,

How did you install basejump_core? Did you use the dbdev cli's install command? If yes, was the dbdev version older than 0.1.4? There was a fix in 0.1.4 about update paths not being installed.

To debug, you can see which update paths are available with select * from pgtle.extension_update_paths('basejump_core'); command. This will return a source, target and a path column. If you see a source = 2.0.1 a target = 2.1.0 and a path = 2.0.1--2.1.0 it means the update path is available and you should be able to create the extension. if the path is null or the entire row is missing then it won't work.

from dbdev.

tiniscule avatar tiniscule commented on June 22, 2024

Thanks for the quick response @imor , yes it was installed with the dbdev local command.

dbdev version: 0.1.5;

result of extension_update_paths query:

image

That second one seems odd, is that to be expected? here's the file structure:

image

from dbdev.

imor avatar imor commented on June 22, 2024

That second one seems odd, is that to be expected?

Yes, that is ok. Postgres doesn't really understand the contents of a version. They are just treated a opaque strings. So it doesn't know which version is greater, it just lists all combinations of source and target.

That's really weird, the data you have shared looks completely fine to me. The create extension "basejump_core" version '2.1.0'; command should have caused pg_tle to first run basejump_core--2.0.1.sql and then run basejump_core--2.0.1--2.1.0.sql to create the extension.

To further debug it can you please share:

  1. The pg_tle extension version you have installed. You can check it by running select extversion from pg_extension where extname = 'pg_tle';
  2. The code for basejump_core from a branch or tag with exact files above.
  3. Check which .sql and .control functions are present by running select * from pg_proc where proname like '%basejump_core%';.

from dbdev.

tiniscule avatar tiniscule commented on June 22, 2024

pg_tle version: 1.0.4
Code: usebasejump/basejump#57
functions:
image

from dbdev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.