Skip to content

Commit 88c4a4e

Browse files
committed
1.0.0alpha release
1 parent 2e114f9 commit 88c4a4e

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: lintcheck format cleansql docs clean test all
22

3-
PLJS_VERSION = 0.8.1
3+
PLJS_VERSION = 1.0.0alpha
44

55
PG_CONFIG = pg_config
66
PGXS := $(shell $(PG_CONFIG) --pgxs)

README.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ PostgreSQL: 14+
1212

1313
### Current Status
1414

15-
Close to initial release.
16-
17-
It compiles, and is on track to match functionality of [PLV8](https://github.com/plv8/plv8).
15+
Currently 1.0.0 alpha release.
1816

1917
Missing:
2018

@@ -38,15 +36,3 @@ Building is meant to be easy, but not all platforms have been worked out as far
3836
```
3937
$ make install
4038
```
41-
42-
## FAQ
43-
44-
Q. Is this a replacement for [PLV8](https://github.com/plv8/plv8)?
45-
46-
A. For general cases, no. PLJS is built to be compact and lightweight, as well as easy to build
47-
and maintain. It uses [QuickJS](https://github.com/bellard/quickjs) as the Javascript engine
48-
instead of using V8. This makes for a very lightweight build with a tradeoff for speed.
49-
50-
Q. How fast is it compared to [PLV8](https://github.com/plv8/plv8)?
51-
52-
A. We shall see, there will be tradeoffs, and before 1.0 release, any tradeoffs will be well documented. Help is always welcome when there is a specific use-case that can be distilled into a simple benchmark.

ROADMAP.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Current Release Version: `0.8`
3232
- [x] procedures/transactions
3333
- [x] find function
3434
- [x] `BigInt`
35-
- [ ] full PLV8 parity
3635

3736
# 1.1
3837

pljs.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
comment = 'PL/JS trusted procedural language'
22

3-
default_version = '0.8.1'
3+
default_version = '1.0.0alpha'
44
module_pathname = '$libdir/pljs'
55
relocatable = false
66
schema = pg_catalog

pljs.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ CREATE OR REPLACE TRUSTED LANGUAGE pljs
1111
HANDLER pljs_call_handler
1212
INLINE pljs_inline_handler
1313
VALIDATOR pljs_call_validator;
14+
15+
CREATE OR REPLACE FUNCTION pljs_version()
16+
RETURNS TEXT
17+
AS 'MODULE_PATHNAME', 'pljs_version'
18+
LANGUAGE C STRICT IMMUTABLE;

src/functions.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ static JSValue pljs_window_get_func_arg_current(JSContext *, JSValueConst, int,
6565
static JSValue pljs_window_object_to_string(JSContext *, JSValueConst, int,
6666
JSValueConst *);
6767

68+
#ifdef EXPOSE_GC
69+
static JSValue pljs_gc(JSContext *, JSValueConst, int, JSValueConst *);
70+
#endif
71+
72+
// Set up any stored procedures we export to Postgres.
73+
Datum pljs_version(PG_FUNCTION_ARGS);
74+
PG_FUNCTION_INFO_V1(pljs_version);
75+
6876
/**
6977
* @brief toString Javascript method for the pljs object.
7078
*
7179
* @returns #JSValue containing the string "[object pljs]"
7280
*/
73-
#ifdef EXPOSE_GC
74-
static JSValue pljs_gc(JSContext *, JSValueConst, int, JSValueConst *);
75-
#endif
76-
77-
// The toString for the pljs object.
7881
static JSValue pljs_object_to_string(JSContext *ctx, JSValueConst this_obj,
7982
int argc, JSValueConst *argv) {
8083
return JS_NewString(ctx, "[object pljs]");
@@ -1492,3 +1495,19 @@ static JSValue pljs_gc(JSContext *ctx, JSValueConst this_val, int argc,
14921495
return JS_UNDEFINED;
14931496
}
14941497
#endif
1498+
1499+
/**
1500+
* @brief Returns the `PLJS_VERSION` to Postgres.
1501+
*
1502+
* Callable function from Postgres `SELECT pljs_version();` which returns
1503+
* a `TEXT` copy of the current compiled version.
1504+
*/
1505+
Datum pljs_version(PG_FUNCTION_ARGS) {
1506+
int32 length = strlen(PLJS_VERSION);
1507+
text *version = (text *)palloc0(sizeof(text) + length);
1508+
1509+
memcpy(VARDATA(version), PLJS_VERSION, length);
1510+
SET_VARSIZE(version, VARHDRSZ + length);
1511+
1512+
PG_RETURN_TEXT_P(version);
1513+
}

0 commit comments

Comments
 (0)