Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
299 views
in Technique[技术] by (71.8m points)

transformation - Convert varchar to uint8_t in PostgreSQL

I am following schema definitions for storing XML data in PostgreSQL for LAS data. I need to store string values in an array. From rules is written:

In the case of string-like data, use uint8_t (common byte) as the interpretation and transform accordingly.

I am trying to write this transformation (convert varchar values into uint8_t) in PostgreSQL. I have close 0 experience with bytes translations and after googling it seems like unit8_t is a C++ type.

What I tried:

SELECT 'sp520145'::bit(8); 

ERROR: function get_bit(text, integer) does not exist

Is it possible to do it all from PostgreSQL?

EDIT:

Convert string to byte is necessary to store text in PcPoint which is defined by XML schema. To create new PcPoint from Postgres I need to pass ARRAY of numeric data type.

SELECT PC_MakePoint(3, 
        ARRAY [*my converted uint8_t*, 70.21, 0.21, 5, 12.1, st_x(geom), 
        st_y(geom), st_z(geom), 255, 0, 0]);
question from:https://stackoverflow.com/questions/65938141/convert-varchar-to-uint8-t-in-postgresql

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...