Comments (5)
Hmm, that is indeed not good.
The list of supported/implemented types can be found in P3Converter class>>#typeMap and since int2, int4 and int8 are already supported, it can't be too hard to add support for more integer types. All that is probably needed is to find the corresponding type oid and add entries. You can also find that type oid from the error you are now seeing.
Could you try that yourself ?
from p3.
I haven't really grokked how glorp and p3 work yet to understand what's going on. But a serial is just an integer (int4) with an autoincrementing sequence attached. Likewise a bigserial is just a int8 with a sequence. I had a look in pg_catalog.pg_type but found no references to serial or bigserial there. For bigint it's really just a synonym so one could use int8 instead.
But when describing a table column as begin of type platform serial
using glorp and then creating the table I end up with a column without any autoincrementing sequence.
from p3.
You have to make a difference between P3 and Glorp.
P3 is a PostgreSQL client that allows you to execute textual SQL queries and process the results converting it into native types.
Glorp is an object-rdbm mapper on top of some DB client. The small class https://github.com/svenvc/P3/blob/master/P3-Glorp/P3DatabaseDriver.class.st is all there is to Glorp from the perspective of P3.
I did the following in psql command line against posgresql 9.6
create table test_1 (s smallint, i integer, b bigint, id serial);
insert into test_1 values (1, 2, 3);
insert into test_1 values (1, 2, 3);
select * from test_1;
s | i | b | id
---+---+---+----
1 | 2 | 3 | 1
1 | 2 | 3 | 2
In Pharo with P3 loaded, I did
(P3Client new url: 'psql://sven@localhost') in: [ :client |
[ client query: 'select * from test_1' ] ensure: [ client close ] ].
And got the correct results back. The data being
#(#(1 2 3 1) #(1 2 3 2))
So from the P3 standpoint all these types are supported and work correctly, AFAICT.
It seems you have some issues with Glorp. Those should be asked elsewhere, I would start with the Pharo mailing lists. Make sure to add some executable code.
Did you try running the Glorp unit tests on your setup ? When I did that a while ago, most of them were OK (like 80/90 %).
from p3.
I do understand the general difference between Glorp and P3. I just assumed that glorp was somehow using the P3 driver for the sql statement generation when creating tables. I could have made that clearer from the get go but I saw no reference to the big*
or *serial
types in P3Converter supportedTypes
and just assumed that the failure to create a database sequence along with the integer column was that of the driver.
I ran across this in Glorp-Platform: PostgreSQLPlatform >> serial
:
^ self typeNamed: #serial ifAbsentPut: [GlorpSerialType new typeString: 'integer' ]
I interpreted that as a fallback and assumed that was just checking the capability of the driver. I was apparently mistaken. Sorry about the noise.
Entirely unrelated to this. Are you planning on adding support for prepare statements? SQL-injection is a nasty thing.
from p3.
If you tell your Glorp session #logging: true and open a Transcript you can see all actual SQL statements being executed.
But Glorp is pretty complex.
I have used platform serial myself and it worked as expected (longer ago, for example https://medium.com/concerning-pharo/reddit-st-in-10-cool-pharo-classes-1b5327ca0740) - I would be quite surprised if it did no longer work or if it broke, but everything is possible.
With an OO-RDBMS mapper you do not have to be scared of SQL injection I think. With pure P3 or SQL in classic statements, you just have to handle your arguments carefully. I have no immediate plans to add prepared statements.
I am closing this issue now, you will probably get more/better help on the pharo mailing lists.
from p3.
Related Issues (20)
- Problems with setting the parameters of P3PreparedStatement HOT 5
- README.md typo HOT 1
- Is there a to-do list for this project... HOT 1
- connect to PGSQL 10.6. but error with Timezone class HOT 5
- Prepared statements error when query is long and differs slightly at the end HOT 7
- Use of pgcrypto, can't call crypt? HOT 24
- Tag reading when the database does not exist HOT 8
- custom P3 error classes HOT 6
- Can't get P3 working after migration from Pharo 8 to 9 HOT 2
- Build against several PostgreSQL versions? HOT 1
- P3DatabaseDriver should have connectSSL HOT 2
- Reset in P3Client>>connect drop password HOT 2
- Pharo 9 - 'P3LogEvent logToTranscript' not working HOT 2
- Question about ip addr support HOT 8
- Unsupported frontend protocol 2.0: server supports 3.0 to 3.0 HOT 4
- Custom column type HOT 3
- P3LogEvent>>#logToTranscript calls deprecated Announcer>>#when:do:
- Bug with Pharo 7 HOT 5
- Can't handle array type HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p3.