Skip to content

Commit

Permalink
Merge pull request #80 from ng-galien/222-dev
Browse files Browse the repository at this point in the history
Release 222.1.0
  • Loading branch information
ng-galien authored Sep 30, 2022
2 parents 25444bf + cfdcc11 commit a1b34b2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 54 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# idea-plpgdebugger Changelog

## [Unreleased]
- Outputs RECORD type for PG 14 & 13 (Thanks to @cvas71)
- Update Docker images.

## [222.0.4]
- Remove indirect debug option
- Remove indirect debug option
- Fix console output

## [222.0.3]
Expand Down
49 changes: 15 additions & 34 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,26 @@ FROM postgres:${TAG}
ARG TAG
ENV PG_LIB=postgresql-server-dev-${TAG}
ENV PG_BRANCH=REL_${TAG}_STABLE
ENV PLUGIN_BRANCH=print-vars-${TAG}
ENV PLUGIN_BRANCH=print-vars

# APT
RUN apt --yes update \
RUN apt --yes update \
&& apt --yes upgrade \
&& apt --yes install \
git \
build-essential \
libreadline-dev \
zlib1g-dev \
bison \
libkrb5-dev \
flex \
$PG_LIB

# POSTGRES SOURCE
RUN cd /usr/src/ \
&& git clone https://github.com/postgres/postgres.git \
&& apt --yes install \
git build-essential libreadline-dev zlib1g-dev bison libkrb5-dev flex $PG_LIB \
&& cd /usr/src/ \
&& git clone -b $PG_BRANCH --single-branch https://github.com/postgres/postgres.git \
&& cd postgres \
&& git checkout $PG_BRANCH \
&& ./configure

# DEBUGGER SOURCE
RUN cd /usr/src/postgres/contrib \
&& git clone https://github.com/ng-galien/pldebugger.git \
&& ./configure \
&& cd /usr/src/postgres/contrib \
&& git clone -b $PLUGIN_BRANCH --single-branch https://github.com/ng-galien/pldebugger.git \
&& cd pldebugger \
&& git checkout $PLUGIN_BRANCH \
&& make clean \
&& make USE_PGXS=1 \
&& make USE_PGXS=1 install

# CLEANUP
RUN rm -r /usr/src/postgres \
&& apt --yes remove --purge \
git build-essential \
libreadline-dev \
zlib1g-dev bison \
libkrb5-dev flex \
$PG_PG_LIB \
&& make clean \
&& make USE_PGXS=1 \
&& make USE_PGXS=1 install \
&& rm -r /usr/src/postgres \
&& apt --yes remove --purge \
git build-essential libreadline-dev zlib1g-dev bison libkrb5-dev flex $PG_LIB \
&& apt --yes autoremove \
&& apt --yes clean

Expand Down
29 changes: 12 additions & 17 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# Docker Image

## Build
## Build the image

> export PG_VERSION=14
> docker build --build-arg "TAG=$PG_VERSION" -t "galien0xffffff/postgres-debugger:$PG_VERSION" .
```bash
export PG_VERSION=14 \
&& export PG_IMAGE=postgres-with-debugger \
&& docker build --build-arg "TAG=$PG_VERSION" -t "$PG_IMAGE:$PG_VERSION" .
```

## Run
## Run the image

> docker run -p 5514:5432 --name PG14-debug -e POSTGRES_PASSWORD=postgres -d galien0xffffff/postgres-debugger:14
## Functions to duplicate from pl_exec.c

* exec_eval_datum
* convert_value_to_string
* plpgsql_fulfill_promise
* get_stmt_mcontext
* instantiate_empty_record_variable
* revalidate_rectypeid
* make_tuple_from_row
* assign_text_var
* assign_simple_var
```bash
export PG_VERSION=14 \
&& export PG_IMAGE=postgres-with-debugger \
&& docker run -p 55$PG_VERSION:5432 --name "PostgresSQL-$PG_VERSION-debug" -e POSTGRES_PASSWORD=postgres -d "$PG_IMAGE:$PG_VERSION"
```
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = net.plpgsql.ideadebugger
pluginName = idea-plpgdebugger
# SemVer format -> https://semver.org
pluginVersion = 222.0.4
pluginVersion = 222.1.0

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class PlExecutor(private val guardedRef: GuardedRef<DatabaseConnection>): Dispos

val query = vars.joinToString(separator = "\nUNION ALL\n", postfix = ";") {
// Fix array type prefixed with underscore and NULL
val realValue = "('${it.value.value.replace("'", "''")}'::${it.value.type})"
val realValue = "('${it.value.value.replace("'", "''")}'::${it.value.type.replace("record","text")})"
var jsonValue: String
var prettyValue: String
// Transform to jsonb
Expand Down

0 comments on commit a1b34b2

Please sign in to comment.