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

Support Composite types #57

Closed
wants to merge 2 commits into from
Closed

Support Composite types #57

wants to merge 2 commits into from

Conversation

Hoverbear
Copy link
Contributor

This is based off #51 which is based off #56 so it's a long way from being ready to merge.

CREATE TYPE Dog AS (
    name TEXT,
    scritches INT
);

CREATE FUNCTION last_dog(a Dog[]) RETURNS Dog
    IMMUTABLE STRICT
    LANGUAGE PLRUST AS
$$
    a.into_iter().last().unwrap_or(None)
$$;

@Hoverbear Hoverbear self-assigned this Jul 4, 2022
@Hoverbear Hoverbear mentioned this pull request Jul 4, 2022
Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/lib.rs Outdated
Some(String::from_utf8(output.stdout.clone()).expect("`cargo`'s stdout was not UTF-8")),
Some(String::from_utf8(output.stderr.clone()).expect("`cargo`'s stderr was not UTF-8")),
Some(
String::from_utf8(output.stdout.clone()).expect("`cargo`'s stdout was not UTF-8"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra space before UTF-8

src/lib.rs Outdated
String::from_utf8(output.stdout.clone()).expect("`cargo`'s stdout was not UTF-8"),
),
Some(
String::from_utf8(output.stderr.clone()).expect("`cargo`'s stderr was not UTF-8"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@eeeebbbbrrrr
Copy link
Contributor

Should probably look into the CI failures, eh?

Signed-off-by: Ana Hobden <operator@hoverbear.org>
Comment on lines +67 to +72
let composite_type_oid: u32 = unsafe {
let mut typoid = 0;
let mut typmod = 0;
pg_sys::parseTypeString("Dog".as_pg_cstr(), &mut typoid, &mut typmod, false);
typoid
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to find a way to wrap this outside this function before this is acceptable.

@eeeebbbbrrrr
Copy link
Contributor

replaced by PR #311. Not really much actual code difference here -- was just easier to write the few lines of code again rather than deal with the merge conflicts since we've moved files around since this PR was created. #311 also included docs and updated to plrust-trusted-pgrx.

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

Successfully merging this pull request may close these issues.

3 participants