GithubHelp home page GithubHelp logo

Comments (8)

ansgarbecker avatar ansgarbecker commented on May 26, 2024

I was just trying to create a test table with a CITEXT column, but to my surprise, on Postgesql 15.1, I get an SQL error saying the type "CITEXT" does not exist:

grafik

CITEXT Documentation says it should work from PostgreSQL 12.0+ so it should work on my local server.

But the documentation also says something about a module installation, and I did not install any module. I have no clue what that means. Can you shed some light on that?

from heidisql.

MolallaComm avatar MolallaComm commented on May 26, 2024

Yes, citext is included with the default distribution but it isn't enabled by default - you have to do something like:

CREATE EXTENSION citext;

to enable it for each database you want to use it in.

from heidisql.

ansgarbecker avatar ansgarbecker commented on May 26, 2024

Thanks for the tip. That did it.

CITEXT is now supported in the next builds, and categorized as text type, so it shows up in the foreign value pulldown you mentioned.

grafik

Note the value in IS.columns.data_type is "USER-DEFINED" for such extension based types. I worked around that by using the value in udt_name, which was the correct "citext" in my test case.

I'm crossing fingers the hardcoded oid 24651 is unique everywhere, and not only on my local server:

NativeTypes: '24651';

from heidisql.

MolallaComm avatar MolallaComm commented on May 26, 2024

Yes - unfortunately - I think the oid changes from server to server/database to database. I was recently doing some similar work and noticed on my machine that citext was 2606673 but on the production server it was 59586 - i think the built in types are always the same, but ones from extensions like citext will vary. Hopefully that won't throw a wrench in things - if you want, i can download tomorrows build and verify for sure that it doesn't work, but I'm reasonably confident it won't if it is counting on 24651 being associated with citext.

from heidisql.

ansgarbecker avatar ansgarbecker commented on May 26, 2024

Yes, that would be helpful if you give it a test and give some feedback. The new build should be available in roughly half an hour.

from heidisql.

ansgarbecker avatar ansgarbecker commented on May 26, 2024

Similar issue in a different project: launchbadge/sqlx#295

from heidisql.

MolallaComm avatar MolallaComm commented on May 26, 2024

Yep - not sure if it helps, but the SQL to get it seems to be:

SELECT 'citext'::regtype::oid;

and I did confirm it is different on every server I tried. Also, this article discusses getting it via the C api:

https://stackoverflow.com/questions/45887484/get-user-defined-type-oid-in-postgresql-extension-c

from heidisql.

ansgarbecker avatar ansgarbecker commented on May 26, 2024

I decided for the xyz::regtype::oid query you mentioned, which is now fired along with the very first query on the connection. This should work on all servers, even if the query fails for some reason - a potential crash is suppressed.

Minor drawback is that this query is fired once on each session, anyway if there is a citext type or not. This is due to a still hardcoded list of data types in HeidiSQL, with citext being one of them. Only dynamic thing is the oid of citext now.

Looking at the pg_type table, I just realized how many data types PosgreSQL has (~300 + ~300 array types), and how few of these are supported in HeidiSQL (~40). So an idea for the future would be to replace the hardcoded data types with a dynamically built list. I only suspect this won't be doable with MySQL and the other protocols.

from heidisql.

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.