最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

postgresql - insert date in composite type during a @DatabaseSetup - Stack Overflow

matteradmin3PV0评论

In postgresql, I have a user defined type like that:

create type my_type as (
  ts  timestamptz,
  val int
)

Then a table using that type:

create table my_table (
  id serial,
  ds my_type
)

I can insert and query data into that table in sql easily, but I can't find a way to insert data into it through an xml dataset file used by @DatabaseSetup for a test. I tried a few different variations like:

<my_table id="1"
          ds='("2025-04-03 09:38:08", 2)'
          ds.ts="2025-04-03 09:38:08"
          ds.val="2">

Whatever the syntax I tried, it results in a .dbunit.dataset.NoSuchColumnException: my_table.ds - (Non-uppercase input column: ds) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.

I can't put data into that column with a composite type. Any idea how to solve that?

Post a comment

comment list (0)

  1. No comments so far